Matlab 3D Plot Help

2 ビュー (過去 30 日間)
Yellow Canary
Yellow Canary 2015 年 1 月 16 日
コメント済み: Yellow Canary 2015 年 1 月 16 日
I am trying to plot my data and create 3D plot. Matlab gives me this error: Warning: Matrix is singular to working precision. My code is below. Can anyone tell me what am I missing? Thank you,
c=0;
p=1;
wu=1;
w=0.5;
Ha=20;
Hb=30;
x=[0:0.01:0.20];
y=[0:0.01:(x-0.01)];
[Pb,Pa]=meshgrid(x,y);
z=(((Pb/(1-Pb))*(p-w))-c)*Hb + w*(Pb*(1-Pa)*Hb + Pa*Pb*Hb)+ wu*Pa*(1-Pb)*Ha;
figure
surf(x,y,z)

回答 (1 件)

Youssef  Khmou
Youssef Khmou 2015 年 1 月 16 日
編集済み: Youssef Khmou 2015 年 1 月 16 日
The program contains an error because y is an empty vector, the version below is altered to have Pb and Pa with same dimensions, to avoid singularity in z, element wise division is used :
c=0;
p=1;
wu=1;
w=0.5;
Ha=20;
Hb=30;
[Pb,Pa]=meshgrid(linspace(0,0.1,40)); % 40 points of linear grid.
z=(((Pb./(1-Pb))*(p-w))-c)*Hb + w*(Pb*(1-Pa)*Hb + Pa*Pb*Hb)+ wu*Pa*(1-Pb)*Ha;
figure
surf(Pa,Pb,z)
  1 件のコメント
Yellow Canary
Yellow Canary 2015 年 1 月 16 日
Here, I have a condition. Pa<Pb and Pb can take values between 0 and 0.20, and can increase by 0.01.

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

カテゴリ

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