Adjustment of z axis of 3d plot

10 ビュー (過去 30 日間)
Osama Anwar
Osama Anwar 2020 年 12 月 15 日
コメント済み: Osama Anwar 2020 年 12 月 15 日
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

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 12 月 15 日
" 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?
  1 件のコメント
Osama Anwar
Osama Anwar 2020 年 12 月 15 日
z axis values have large extremes (max and min values) for corresponding zai value. I want my z values closer to xy plane so that I can have better visualization of shape. I know this can be done by taking logarithmic scale along z axis but it gives distorted results for negative values.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by