I am new to MATLAB so I don't even know if this is possible, but here it is... I am trying to print multiple lines in a single graph using the plot function. The problem is, I want to be able to specify how many lines the graph should display by simply changing a variable, for example: {This is the pseudo code to what I want to do}
number_of_lines = 4;
x = 0:0.5:5;
function_output[number_of_lines];
for n=0:number_of_lines
function_output[n] = sin(n + x);
end
for n=0:number_of_lines
plot(x,function_output[n]);
end
I know the above pseudo code isn't exactly MATLAB, but all I want to know if such algorithm is possible to do in MATLAB.