Adjustment of z axis of 3d plot
10 views (last 30 days)
Show older comments
I'm ploting a 3d graph of displacement of single degree of freedom system against a loading of sin wave.
First I inputed the function. It has its value in terms of a and b. I calculated a and b as initial conditions were given for the function. The final equation I get is only in form of variables x(time) and y(beta) and zai.
I added a for loop so that I may see affect of zai on the displacement. For different zai values displacement varies very much between positive and negative values. I wanted to squeez z values to smaller values for better visualization. Log scale can not be used because negative displacements are also present. What should I do?
clear
clc
syms w wd x a b zai wbar eq1 eq2 u0 v0 y z xx yy
po=1000;
k=40609481.90;
m=12000;
w=sqrt(k/m);
wbar=y*w;
wd=w*sqrt(1-zai^2);
F(x,y)=exp(-zai*w*x)*(a*cos(wd*x)+b*sin(wd*x))+po/k*1/((1-y^2)^2+(2*zai*y)^2)*((1-y^2)*sin(y*w*x)-(2*zai*y)*cos(y*w*x));
F(0,y);
derivF(x,y)=diff(F(x,y),'x');
%derivF(0,y);
eq1=F(0,y)==0;
eq2=derivF(0,y)==0;
sol=solve([eq1,eq2],[a,b]);
%sol.a;
%sol.b;
avalue=sol.a;
bvalue=sol.b;
G(x,y)=subs(F(x,y),[a,b],[avalue,bvalue]);
%G(x,y);
%double(G(0.003,0.05));
x=0:0.005:2.5;
y=0:0.005:3;
[xx,yy]=meshgrid(x,y);
G=matlabFunction(G);
zai=0:0.01:1;
for n=zai
z=G(xx,yy,n);
figure(1),clf(1)
surface(xx,yy,z)
axis('square')
axis('tight', 'manual')
zlim([-5*10^-4 5*10^-4])
shading interp
colormap hsv
view(3)
%grid on
drawnow
end
0 Comments
Answers (1)
KALYAN ACHARJYA
on 15 Dec 2020
" I wanted to squeez z values to smaller values for better visualization."
zai=0:0.001:1; %z values to smaller values??
for n=1:length(zai)
z=G(xx,yy,zai(n));
figure(1),clf(1)
surface(xx,yy,z)
axis('square')
axis('tight', 'manual')
zlim([-5*10^-4 5*10^-4])
shading interp
colormap hsv
view(3)
grid on
drawnow
end
Hope I understood this question, if not please feel free to point it out.
better visualization.??
Do you have any pictorial sample representation/image?
See Also
Categories
Find more on Line 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!