Plotting a linear equation

Hi!
I'm trying to write a function which takes two vectors e.g a=[1;1] and b=[2;1] and plots the solution of
a.'*(x-b)=0 on a 2D plot. So basically, with these values I'm trying to plot m=3-n but I have to write it as a function so that it can take variables. How can I achieve this?
Thanks

2 个评论

You can use the function fplot, as shown here, to plot the equations.
I have read about it but what I'm looking for is to see if it's possible to have a matrix with 2 parametric elements and plot them. I ended up using the elements seperately, solving the equation manually and it works.
x1=0:5;
x2=(a(1)*b(1)+a(2)*b(2)-a(1)*x1)/a(2);
plot(x1,x2)

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Mathematics 的更多信息

提问:

2016-9-30

评论:

2016-9-30

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by