save all value array in loop for
Show older comments
Can you help me how to save all value under array form in for loop.. with @myfun is function 2 variable, and I put variable_1 = X(1) ; variable_2 = X(2)
So result of X showed: for example 2.123 5.245
Mycode below:
N=10;
valueOfX = zeros(1,N);
for i=1:N
Pnet= 100+50*i;
x0=[10,10];
options=optimoptions('fsolve','Display','iter');
X=fsolve(@myfun,x0,options);
valueOfX(i)=X;
disp(valueOfX(i)/0.3048);
end
2 Comments
Cris LaPierre
on 31 Mar 2020
It would be helpful if you could also share your function myfun
Nhu Y Ha
on 1 Apr 2020
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!