Storing function outputs to an array so they can be plotted
2 views (last 30 days)
Show older comments
Hi,
Im new to MATLAB and am trying to get a for loop to save a range of outputted values so that i can then plot them against data i already have (Lambda). Any help would be greatly appreciated as im at a loss.
Currently my code only saves 1 value for A and 1 value for I.
my code is;
for A= 1,1:20;
H_l = 2*(A+1);
Sig_Lambda = 1*10^-9;
I = A*H_l*Sig_Lambda
end
plot(Lambda,I)
1 Comment
Cris LaPierre
on 8 Jan 2022
I think there is a syntax error in your loop counter. Should it be this?
for A=1:1:20
Accepted Answer
More Answers (0)
See Also
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!