How do i plot the 3d profiles graph located below in matlab.

I am looking to reproduce the graph below. I have the formula and I am using matlab. But I can only get an arc. I cannot get the graph to look like that. Thanks

 Respuesta aceptada

Joseph Cheng
Joseph Cheng el 22 de Jul. de 2014
Editada: Joseph Cheng el 22 de Jul. de 2014
This should get you close to where you need to go
[X,Y] = meshgrid(-8:.5:8);
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin(R)./R;
h=figure;
ax=surf(X,Y,Z,'EdgeColor','none');
set(gca, 'Color', 'None')
set(gcf,'Color',[0 0 0])
box on
set(gca,'Ycolor',[1 1 1])
set(gca,'Xcolor',[1 1 1])
set(gca,'Zcolor',[1 1 1])
grid off
set(gca,'linewidth',1.2)

13 comentarios

the thing is my formula is this [x,y]=meshgrid(-.002:.0005:.002, -.0006:.0002:.0006); m = .619211*x.^2; j = (53913.*x.^8.* + 2560.*x.^6).^1/2; l = j.*232.192; q = l - 53913.*x.^4; f = q.^1/3; n = m./f; g = (53913.*x.^8.^2 + 2560.*x.^6).^1/2; h = 232.192.*g; k = h - 53913.*x.^4.; b = .0011982.*(k).^1/3; z = f - b; surf(x,y,z);shading interp
and so it's not just like a regular figure. it came with a formula for which i had to solve for and then graph but my graph isn't coming out like theirs and they used the same formula
Joseph Cheng
Joseph Cheng el 22 de Jul. de 2014
Editada: Joseph Cheng el 22 de Jul. de 2014
So the question isn't how to get your curve to look like the 3d figure but why is your curve not the same. and please edit using the code{} button so it is legible.
Joseph Cheng
Joseph Cheng el 22 de Jul. de 2014
Editada: Joseph Cheng el 22 de Jul. de 2014
One thing i noticed is that your equations take no account for y. So that's one reason you only get arc. There is no y axis component in your equations therefore for all instances of y you'll get only variation in x.
how would i be able to fix that?
if true
% code
end
[x,y]=meshgrid(-.002:.0005:.002, -.0006:.0002:.0006);
m = .619211*x.^2;
j = (53913.*x.^8.* + 2560.*x.^6).^1/2;
l = j.*232.192;
q = l - 53913.*x.^4;
f = q.^1/3;
n = m./f;
g = (53913.*x.^8.^2 + 2560.*x.^6).^1/2;
h = 232.192.*g;
k = h - 53913.*x.^4.;
b = .0011982.*(k).^1/3;
z = f - b;
Joseph Cheng
Joseph Cheng el 23 de Jul. de 2014
Editada: Joseph Cheng el 23 de Jul. de 2014
Very dumb question, but have you checked that you are using the same equations they are? Just from the code, I do not recognize what is being accomplished here and i only have your set to try to fit some y in there? Are all your units correct?
Here, i attached a blow up screen shot(the bottom pic) of what the equation that i am using is. so my x value is the radius(a), my y value is the pressure(p) and my z value is height(h). Pressure should be a constant right? but yesterday i rearranged it and included y in the equation as a variable and the top picture is what i got when solving for z. is it correct?
Joseph Cheng
Joseph Cheng el 23 de Jul. de 2014
Editada: Joseph Cheng el 23 de Jul. de 2014
No attachment, also if your y axis is pressure which you say is a constant how would you expect there to be variations in the y axis?
here's the attachment
Okay well i would recheck your equations and get it to be a function of positional x,y, and z space as it looks like that is the axes the plots are in. If the equation turns out to be deflection and runout from the center you can get the runout from center as a function of x and y.
okay thank you, sorry i'm just an intern....

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Preguntada:

el 22 de Jul. de 2014

Comentada:

el 23 de Jul. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by