![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/363109/image.png)
I want to sketch the parametric euqations lies on the cone, but the cone is so small and the lines are sparser than it should be.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
수정 이
am 19 Sep. 2020
Kommentiert: Star Strider
am 24 Sep. 2020
parametric euqations is x=tcost, y=tsint, z=t
and the euqation of the cone is z^2=x^2+y^2
my code looks like this
t=linspace(-2*pi,2*pi,100);
x=t.*cos(t);
y=t.*sin(t);
z=t;
plot3(x,y,z);
hold on;
u=linspace(-2*pi,2*pi,100);
v=linspace(-2*pi,2*pi,100);
[u,v]=meshgrid(u,v);
x=cos(u).*sin(v);
y=cos(u).*cos(v);
z=cos(u);
surf(x,y,z)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/363103/image.png)
I can't find any mistake in my code.
Answer is that the line should be denser.
What is the problem of my code?
I appreciate any help. Thank you.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 19 Sep. 2020
Scale the size of the cone up by multiplying its variables with some appropriate constant (that I call a ‘Magnification Factor’ here).
Example —
t=linspace(-2*pi,2*pi,100);
x=t.*cos(t);
y=t.*sin(t);
z=t;
plot3(x,y,z, '-r', 'LineWidth',2);
hold on;
u=linspace(-2*pi,2*pi,100);
v=linspace(-2*pi,2*pi,100);
[u,v]=meshgrid(u,v);
x=cos(u).*sin(v);
y=cos(u).*cos(v);
z=cos(u);
mf = 6; % ‘Magnification Factor’
surf(x*mf,y*mf,z*mf, 'EdgeColor','none')
grid on
axis('equal')
producing:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/363109/image.png)
.
4 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Pulsed Waveforms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!