MATLAB: How to plot a 2D graph using for loop values

2dfor loopplotting

Hello, Could anyone tell me what the problem is in the following code?
Many thanks.
% code:
lambda= [1.5:0.005:1.6];
llambda=length(lambda);
for di=1:llambda
k(di)=2*3.14/lambda(di)
end
lambda= [1.5:0.005:1.6];
plot(lambda,k);

Best Answer

Thanks, Cheng. I would like to plot the same thing, however. using for loop. Just curious how to plot the data using for loop? Could you help?