how to create a changing variable for fsolve

Posted by Shun Miyamoto on Stack Overflow See other posts from Stack Overflow or by Shun Miyamoto
Published on 2012-07-06T05:35:27Z Indexed on 2012/07/06 9:16 UTC
Read the original article Hit count: 264

Filed under:

i want fsolve to calculate the output for different uc each time (increasing uc by 0.001 each time). each output from fsolve should be sent to a simulink model seperatly. so i set a loop to do so, but i believe that at the currenty constellation (if it will work)will just calculate 1000 different values? is there a way to send out the values seperately?

if not, how can i create a parameter uc. that goes from 0 to say 1000? i tried uc=0:0.001:1000, but again, the demension doen't seem to fit.

how do i create a function that takes the next element of a vector/matrix each time the function is called?

uc=0;
for i=0:1000
x0=[1,1,1];
y=x0(1);
u=x0(2);
yc=x0(3);
options=optimset('Display','off'); 
x= fsolve(@myfun,x0,options,uc,d,spacing_amplitude,spacing_width);
end

best regards

© Stack Overflow or respective owner

Related posts about matlab