Create a surface from data and various vectors

8 ビュー (過去 30 日間)
ClaudioP
ClaudioP 2018 年 1 月 23 日
コメント済み: ClaudioP 2018 年 1 月 23 日
Hello and thanks in advance,
I have the following code that I wish to improve. Specifically, I want to make the surface contours appear and have a certain opaque color. I just can't figure out how to arrange the vectors so that I can create a surf plot. Any better method is much appreciated.
{vt1=zeros(51,2);
vv=zeros(51,51);
vt=0:0.02:1;
vt1(:,1)=transpose(vt);
vt1(:,2)=vt1(:,1);
zero=zeros(51,2);
mu=tand(2/3*40);
psi=0.33;
for i=1:1:51
vv(:,i)=vt(i);
mnm(i,1)=psi*vt(i)*(1-vt(i))^(0.95);
mnm(i,2)=-1*psi*vt(i)*(1-vt(i))^(0.95);
hnm(i,1)=mu*vt(i)*(1-vt(i))^(0.95);
hnm(i,2)=-mu*vt(i)*(1-vt(i))^(0.95);
hh(:,i)=transpose(linspace(hnm(i,2),hnm(i,1),51));
mmp(:,i)=psi.*((vv(:,i).^2.*(1-vv(:,i)).^(2*0.95))-((hh(:,i)/mu).^2)).^(0.5);
mmn=-1*mmp;
end
figure(4)
plot3(vt1,mnm,zero,'b')
hold on
plot3(vt1,zero,hnm,'r')
hold on
plot3(vv,mmp,hh,'g')
hold on
plot3(vv,mmn,hh,'g')
hold on}

回答 (1 件)

KSSV
KSSV 2018 年 1 月 23 日
vt1=zeros(51,2);
vv=zeros(51,51);
vt=0:0.02:1;
vt1(:,1)=transpose(vt);
vt1(:,2)=vt1(:,1);
zero=zeros(51,2);
mu=tand(2/3*40);
psi=0.33;
for i=1:1:51
vv(:,i)=vt(i);
mnm(i,1)=psi*vt(i)*(1-vt(i))^(0.95);
mnm(i,2)=-1*psi*vt(i)*(1-vt(i))^(0.95);
hnm(i,1)=mu*vt(i)*(1-vt(i))^(0.95);
hnm(i,2)=-mu*vt(i)*(1-vt(i))^(0.95);
hh(:,i)=transpose(linspace(hnm(i,2),hnm(i,1),51));
mmp(:,i)=psi.*((vv(:,i).^2.*(1-vv(:,i)).^(2*0.95))-((hh(:,i)/mu).^2)).^(0.5);
mmn=-1*mmp;
end
figure
hold on
% plot3(vv,mmp,hh,'g')
surf(real(vv),real(mmp),hh)
surf(real(vv),real(mmn),hh)
% plot3(vv,mmn,hh,'g')
plot3(vt1,mnm,zero,'b')
plot3(vt1,zero,hnm,'r')
shading interp
YOu need to initilaize the variables inside loop.
  1 件のコメント
ClaudioP
ClaudioP 2018 年 1 月 23 日
Thank you that did it!

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

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by