How to use a loop to increase polynomial order and store results
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
KALYAN ACHARJYA
el 3 de Abr. de 2020
Editada: KALYAN ACHARJYA
el 3 de Abr. de 2020
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 comentarios
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!