How do I plot parametric equations in Matlab?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/170968/image.png)
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 Commenti
Walter Roberson
il 4 Mar 2018
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.
Risposte (0)
Vedere anche
Categorie
Scopri di più su Annotations in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!