How plot a shifted Parabola?

2 Ansichten (letzte 30 Tage)
Ali
Ali am 4 Mär. 2011
I know Parabola have formula z=x^2+y^2 now I want to plot it when it has simple shifted like image: http://i55.tinypic.com/33y50kx.gif I know how to plot3 or surf but I don't know how to plot3 this one.

Antworten (2)

Paulo Silva
Paulo Silva am 4 Mär. 2011
plot3(X+10,Y+10,Z); %this shifts the parabola 10 units on both x and y axis
  2 Kommentare
Ali
Ali am 5 Mär. 2011
Please check out this
http://www.mathhelpforum.com/math-help/f43/parabola-polar-coordinates-173404.html
I need this type of shifting!
Paulo Silva
Paulo Silva am 5 Mär. 2011
That's more like rotation than shifting.

Melden Sie sich an, um zu kommentieren.


Paulo Silva
Paulo Silva am 5 Mär. 2011
x=-10:0.1:10;
y=x;
z=x.^2+y.^2;
ang=pi/4;
sm=[cos(ang) 0 sin(ang)
0 1 0
-sin(ang) 0 cos(ang)];
r=sm*[x;y;z];
x=r(1,:);y=r(2,:);z=r(3,:);
[x,y]=meshgrid(x,y);
plot3(x,y,z)
  1 Kommentar
Ali
Ali am 5 Mär. 2011
Rotation is better!
what you code is not what I want.
My code:
clc
clear all
spi=sin(pi/4);
cpi=cos(pi/4);
f=0:pi/20:pi;
t=0:(2*pi)/20:2*pi;
[F T]=meshgrid(f,t);
x=sin(F).*cos(T);
y=sin(F).*sin(T);
z=(x.^2+y.^2);
w=[cpi 0 -spi;0 1 0;spi 0 cpi];
surf(x,y,z);
This code just draw Parabola without rotation how can I do w*[x,y,z]??

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by