Surface plot by using three vectors of the same length
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
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.
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...
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.
Thank you very much for your helpful ptompt response,Star Strider
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
How to insert a title to the plot automatically?I am trying to type (Title'name')in the script but it didn't work.
Thanks a lot,Mr.Star Strider.
As always, my pleasure!
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!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 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)
