MATLAB: How to plot loop iteration in same figure

nonlinear optical fiber

Hello all, I need to plot my gama for different instance loop iteration. This means I should save data for all loop and plot all in the same figure. Please see the following code. clear; gama=[1.20, 2.90 ,3.1] for gama ? end How to compute ?

Best Answer

Check the below pseudo code, which plots the same function for different values and the function is plotted in a loop. Understand the below code and apply it to your case.
x = linspace(0,2*pi) ;
A = 1:10 ;
figure
hold on
for i = 1:length(A)
y = A(i)*sin(x) ;
plot(x,y)
end