plot a 3d function (with three independent variable)
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
I am traying to plot
in matlab like this picture! how can i do it? thank you
in matlab like this picture! how can i do it? thank you
採用された回答
Star Strider
2021 年 4 月 24 日
6 件のコメント
Niloofar Moosavi
2021 年 4 月 24 日
hi, thanks for your answer but i want it with shadows like this picture i tried this code but it wasn't like my picture
My pleasure!
I have no idea what you intend by ‘shadows’, since all that is necessary to produce them is to create a lighting effect.
Example —
N = 50;
xv = linspace(-10,10, N);
yv = linspace(-10,10, N);
zv = linspace(-10,10, N);
vfcn = @(x,y,z) 4*x.^2 + 9*y.^2 + 4*z.^2;
[Xm,Ym,Zm] = meshgrid(xv,yv,zv);
Vm = vfcn(Xm,Ym,Zm);
figure
p = patch(isosurface(Xm, Ym, Zm, Vm, 36));
isonormals(Xm,Ym,Zm,Vm,p)
p.FaceColor = 'red';
p.EdgeColor = 'none';
daspect([1 1 1])
view(3);
% axis tight
axis('equal')
camlight
lighting gouraud
grid on
hold on
plot3([-5 5], [0 0], [0 0], '-k')
plot3([0 0], [-5 5], [0 0], '-k')
plot3([0 0], [0 0], [-5 5], '-k')
hold off
text(-6, 0, 0, '$x$', 'Interpreter','latex', 'FontSize',20)
text(0, -6, 0, '$y$', 'Interpreter','latex', 'FontSize',20)
text(0, 0, 6, '$z$', 'Interpreter','latex', 'FontSize',20)

This is partially copied from the isosurface documentation.
Niloofar Moosavi
2021 年 4 月 24 日
thank you so much and how can i unfill the graph like picture?
My pleasure!
If by ‘unfill’ you mean to see inside it, add this assignment —
p.FaceAlpha = 0.75; % See Inside The Volume!
so the revised code is now —
N = 50;
xv = linspace(-10,10, N);
yv = linspace(-10,10, N);
zv = linspace(-10,10, N);
vfcn = @(x,y,z) 4*x.^2 + 9*y.^2 + 4*z.^2;
[Xm,Ym,Zm] = meshgrid(xv,yv,zv);
Vm = vfcn(Xm,Ym,Zm);
figure
p = patch(isosurface(Xm, Ym, Zm, Vm, 36));
isonormals(Xm,Ym,Zm,Vm,p)
p.FaceColor = 'red';
p.EdgeColor = 'none';
p.FaceAlpha = 0.75; % See Inside The Volume!
daspect([1 1 1])
view(3);
axis tight
camlight
lighting gouraud
grid on
hold on
plot3([-5 5], [0 0], [0 0], '-k')
plot3([0 0], [-5 5], [0 0], '-k')
plot3([0 0], [0 0], [-5 5], '-k')
hold off
text(-6, 0, 0, '$x$', 'Interpreter','latex', 'FontSize',20, 'Horiz','center', 'Vert','middle')
text(0, -6, 0, '$y$', 'Interpreter','latex', 'FontSize',20, 'Horiz','center', 'Vert','middle')
text(0, 0, 6, '$z$', 'Interpreter','latex', 'FontSize',20, 'Horiz','center', 'Vert','middle')

Change that value to something between 0 (fully transparent) and 1 (not at all transparent) to get the result you want.
.
Niloofar Moosavi
2021 年 4 月 25 日
thanks alot
Star Strider
2021 年 4 月 25 日
As always, my pleasure!
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Volume Visualization についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
