Need help storing each iteration from "for loop" to a vector.
古いコメントを表示
I have a "newton.m" (newton's method) file that I want to iterate 1000 times starting from -3 to 4. I am having issues with storing each iteration output to a vector. Can someone please help? I have attached the "newton.m" file.
I WANT TO STORE EACH ITERATION SO THAT I CAN PLOT XVEC VS X.
This is what I got so far:
---------------------------------------
ish = @(z) newton( 'x^3-2*x^2-11*x+12', '3*x^2-4*x-11',z, .0000001, 30 );
x= linspace(-3,4,1000);
xvec=zeros(1,length(x));
for ii= 1:length(x)
root= ish(x(ii));
xvec(ii)=root
end
------------------------------
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!