How to save all the results from the loop into a vector
Show older comments
Hello all,
so what I have is this:
tita = [-90 : 10 : 90] ;
Ftita0 = ( sin( ((k0 * lnov) / 2) * ((c / Vio0) - cos(tita)) ) ) / ( ((k0 * lnov) / 2) * ((c / Vio0) - cos(tita)) ) ;
What I need to do right now is, make it solve all Ftita0 with the tita above from -90 to +90 and plot them on a log graph. X to be tita and Y to be Ftita0. I tried with a for cycle, it solves the expression, but it just replaces Ftita0's result every time it goes through and I can't think of a way to save it to a variable which can be a vector.
Any ideas? Thank you for looking into this :)
Answers (1)
ANKUR KUMAR
on 3 Jan 2018
For saving the results in vector form after completing every loop, then just use A(i,:)
example:
A=randi(25,10,20);
for i=1:20
AA(i,:)=A(:,i)+randi(2,1,1);
end
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!