我有以下两行:
y = m1*x + c1 ; 
y= m2*x +c2 ; 
Run Code Online (Sandbox Code Playgroud)
现在我想在MATLAB中的图像中绘制这些线条?
这是一个非常基本的问题,我相信你应该能够看看Matlab帮助手册来解决.您想首先创建离散数量的样本向量,然后将向量插入方程式以生成向量y,然后绘制.
就像是:
x=1:0.01:100; %//Adjust accordingly for higher/lower resolution
y1=m1.*x+c1 %//Note the . product, since you are dealing with a vector x
y2=m2.*x+c2 %//Use the same x here, since you want both lines on the same graph.
figure
plot(x,y1,'r') %//plot y1 in red
hold on         %//Allows to plot in same figure
plot(x,y2,'b') %//plot y2 in blue
Run Code Online (Sandbox Code Playgroud)