Why does changing the order of my multiplication yield different graphs?
Show older comments
I was doing an activity where I had to use parametric equations to graph the surface formed by revolving the curve
about the x-axis. I first did it like this:
>> u=linspace(0,1,50);
>>v=linspace(0,2*pi,50);
>>[U,V]=meshgrid(u,v);
>>X=(3*(U-1/3).^2)*cos(V);
>>Y=(3*(U-1/3).^2)*sin(V);
>>Z=U;
>> surf(X,Y,Z)
And got the strange graph, with very strange bounds:

When I switched the order of multiplication in the X and Y parametric equations, to put the trig first:
>> u=linspace(0,1,50);
>>v=linspace(0,2*pi,50);
>>[U,V]=meshgrid(u,v);
>>X=cos(V)*(3*(U-1/3).^2);
>>Y=sin(V)*(3*(U-1/3).^2);
>>Z=U;
>>surf(X,Y,Z)
The graph was exactly what I was looking for:

Can anybody help me understand why the order of multiplication gives me a different result? Thanks.
Accepted Answer
More Answers (0)
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!