How to use a loop to increase polynomial order and store results
8 ビュー (過去 30 日間)
古いコメントを表示
Hi, sorry if this is not very clear, I am not confident with code at all.
I am attempting to fit polynomials to messy, scattered data in matlab. I need to evalute which polynomial order is best for each dataset. I am happy with how to statistically evaluate this for each polynomial size but I would like to set up a loop so I don't need to execute each one individually.
I would like to execute
for
T0 = horzcat((t^0));
execute some calculations, resulting in e.g. R2 = 0.45, AR2 = 0.4
T1 = horzcat((t^0), (t^1));
execute the calculations
T2 = horzcat((t^0), (t^1), (t^2));
execute the calculations
Up to around T9, each time storing the two resultant values in some way, can someone please advise a way that I can do this?
(I do have working code for the calculations if that would be helpful)
Thank you
0 件のコメント
回答 (1 件)
KALYAN ACHARJYA
2020 年 4 月 3 日
編集済み: KALYAN ACHARJYA
2020 年 4 月 3 日
One way hints: Start with T(1) to T(10), Matlab doesnot allow zero indexing
T(1)=t^1
for i=2:9
T(i)=[T(i-1),t^i];
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!