Surface plot by using three vectors of the same length
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
How could I generate a surface plot by using three vectors of the same length and there is no relation between them?I know that I have to generate a meshgrid from x and y ,but the z vector was obtained experiamentally and there is no relation to link it to x and y to generate its mesh of the same size.So,what should Ido?
採用された回答
Star Strider
2020 年 8 月 13 日
The surf plot only requires that ‘Z’ is a matrix. The ‘X’ and ‘Y’ arguments are good to have, although not necessary (and they can be vectors).
With no information about what the ‘Z’ vector actually is or what it contains, I can only suggest that to create a matrix from it will likely require the reshape function.
15 件のコメント
MOHAMED ABDULAZIM
2020 年 8 月 13 日
編集済み: MOHAMED ABDULAZIM
2020 年 8 月 13 日
I have data in z vector but I need to generate it's matrix too.
Star Strider
2020 年 8 月 13 日
I understand that.
You need to use reshape with it to create a matrix from it, however the structure and contents of the vector will affect how you do that. I do not have that information, so I cannot suggest how to best use reshape with it.
"...the z vector was obtained experiamentally and there is no relation to link it to x and y"
Then the experment was pretty-much pointless it would seem if you don't have the conditions of the independent variables recorded at the time the data were taken.
You can use scatter3 with a sequence of x,y coordinates, but to draw a surface will require more info than you have at hand unless you're leaving out some key information (like the data were recorded manually but just not entered.)
scatteredinterpolant can be used to fill in data that are scattered in location for surface plots and such; how successful will depend on the locations of the observations and how smooth the surface is.
Can't create data from nothing, whatever method is used...
MOHAMED ABDULAZIM
2020 年 8 月 13 日
Here is the data that I want to draw
Try this:
T1 = readtable('all data at Re12000.xlsx');
Q1 = T1(1:10,:);
Thm = reshape(T1.Theta1, 4, []);
Bem = reshape(T1.Beta1, 4, []);
Num = reshape(T1.Nu1, 4, []);
figure
surfc(Thm, Bem, Num)
grid on
xlabel('\theta_1')
ylabel('\beta_1')
zlabel('\nu_1')
view(70,30)
producing:

All the information necessary to plot the surface is in the file.
.
MOHAMED ABDULAZIM
2020 年 8 月 13 日
編集済み: MOHAMED ABDULAZIM
2020 年 8 月 13 日
Is the readtable function available in MATLAB 2013a?
It was introduced in R2013b.
Without it, the code changes to:
D = xlsread('all data at Re12000.xlsx');
Thm = reshape(D(:,1), 4, []);
Bem = reshape(D(:,2), 4, []);
Num = reshape(D(:,3), 4, []);
The rest of the code is unchanged.
MOHAMED ABDULAZIM
2020 年 8 月 14 日
Thank you very much for your helpful ptompt response,Star Strider
Star Strider
2020 年 8 月 14 日
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
MOHAMED ABDULAZIM
2020 年 8 月 14 日
How to insert a title to the plot automatically?I am trying to type (Title'name')in the script but it didn't work.
Star Strider
2020 年 8 月 14 日
MOHAMED ABDULAZIM
2020 年 8 月 14 日
Thanks a lot,Mr.Star Strider.
Star Strider
2020 年 8 月 14 日
As always, my pleasure!
MOHAMED ABDULAZIM
2020 年 8 月 14 日
Could I save matlab figures to a certain directory and make this automatic in script file?I am writing a script file for drawing many surfaces.
Yes.
Access the R2013a documentation with:
doc saveas
doc print
Use the documentation provided with R2013a, not the online documentation that I lniked to here, that is for R2020a. All the other related functions linked to in and at the end of that documentation page that I lniked to here were introduced after R2013a.
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Surface and Mesh Plots についてさらに検索
タグ
参考
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)
