【发布时间】:2010-12-05 06:24:19
【问题描述】:
我是 MATLAB 的新手,所以我什至不知道这是否可能,但它是... 我正在尝试使用 plot 函数在单个图形中打印多条线。问题是,我希望能够通过简单地更改变量来指定图形应该显示多少行,例如:{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
我知道上面的伪代码并不完全是 MATLAB,但我只想知道这种算法是否可以在 MATLAB 中完成。
【问题讨论】: