figure from for loop

Would someone like to help me to get a figure out of the values?
function [x, y] = gauss_elim5 (n)
A = [n;n]; b = [n;1]; j=1:20; for i=j tic x = A\b; times(i)=toc; end
y=mean(times) ;
end
n = [10 20 30 40 50 60 70 80 90 100];
for j = 10:10:100; gauss_elim5(j); j y=ans end
figure plot(j,y)

2 件のコメント

Image Analyst
Image Analyst 2015 年 5 月 15 日
Joseph Cheng
Joseph Cheng 2015 年 5 月 15 日
編集済み: Joseph Cheng 2015 年 5 月 15 日
Initial comment would be that you should save the output for each loop. currently you are overwriting the previous calculation each time you are performing your loops in the gauss_elim5() as well as the script in y=ans.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2015 年 5 月 15 日

編集済み:

2015 年 5 月 15 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by