필터 지우기
필터 지우기

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 CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by