フィルターのクリア

How do I plot parametric equations in Matlab?

4 ビュー (過去 30 日間)
FortuitousMonkey
FortuitousMonkey 2018 年 3 月 4 日
編集済み: FortuitousMonkey 2018 年 3 月 13 日
I have the attached equations for lines r & s. I have used the below code to plot r but I can not plot s.
I need to find the value of a knowing that both lines intersect at one point. Find the coordinates of the intersection point.
1. How do I plot 's'?
2. Is my working for plotting 'r' correct?
>> t=-10:0.5:10;
>> x=3-t;
>> y=1+2*t;
>> z=-4+3*t;
>> figure(1)
hold on
plot3(x,y,z,'xr')
plot3(x,y,z)
hold off
grid on
xlabel('x axis')
ylabel('y axis')
zlabel('z axis')
  4 件のコメント
Walter Roberson
Walter Roberson 2018 年 3 月 4 日
syms x y z a lambda
eqn = [x==3-lambda,y==1-2*lambda,z==-4+3*lambda,x+2*y+3*z==a,3*x-2*y+z==-a];
sol = solve(eqn);
sol.x, sol.y, sol.z, sol.lambda, sol.a
... all of which gets you one point, but is not enough to allow you to plot s independently as a line.
Consider
x + 2 * y + 3 * z == a
3 * x + 2 * y + z == -a
then from the first one,
x = a - 2 * y - 3 * z
substitute that into the second one:
3 * (a - 2 * y - 3 * z) + 2 * y + z == -a
which is
3*a - 4*y - 8*z == -a
which is
4*a - 4 * y - 8*z == 0
or
a - y - 2 * z == 0
for any given a value, that is only enough information to deduce
y = a - 2 * z
which gives you a relationship between y and z, but does not constrain z. You would need to plot using all z from -inf to +inf, and each z value would have a corresponding x and y point -- and this is the case for each a value.
FortuitousMonkey
FortuitousMonkey 2018 年 3 月 13 日
編集済み: FortuitousMonkey 2018 年 3 月 13 日
Comment removed there was an error in my code.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by