MATLAB: Save all value array in loop for

iteration loop

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

Best Answer

Related Question