Create a block of MATLAB code that uses a loop to store the
Create a block of MATLAB code that uses a loop to store the squares of the whole numbers 1 through 10. These values should be stored in a row vector array.
Solution
%% Matlab Code using FOR loop.
%%A=[1:10]
%%B is the output
function B=square (A)
for i=1:length(A)
B(i)=A(i).^2
end
%%Plot the graph between A and B
plot(a,b)
