Need help with a contour plot

조회 수: 2 (최근 30일)
Kaden Bauernfeind
Kaden Bauernfeind 2022년 11월 11일
댓글: Star Strider 2022년 11월 11일
I need to be able to make a contour plot where I have the velocity value on the x axis and power at sea level on the y axis and two contour plots that use the values for Power Available and Power Required. The Velocity is a 1x 21 matrix, the Power avalible is a 21x 200 matrix, and the power required is a 21x 200 matrix. I'm pretty new at MATLAB and any help would be very appreiciated below is a picture of roughly what it should look like.

답변 (1개)

Star Strider
Star Strider 2022년 11월 11일
편집: Star Strider 2022년 11월 11일
It is difficult for me to understand what you want.
It is certainly poossible to get only one contour from each matrix and then plot them together (using the hold function) on one plot.
Getting the zero contour would go something like this —
[X,Y,Z] = peaks(50);
figure
surf(X,Y,Z)
colormap(turbo)
hold on
contour3(X,Y,Z,[0 0], '-r', 'LineWidth',3)
hold off
figure
[c,h] = contour(X,Y,Z,[0 0]);
% idx = find(c(1,:)==0 & rem(c(2,:),1)==0 & c(2,:)>0)
Unlike in this issultration, I get the impression that there should be only one contour in your data, so the ‘c’ output should contain the (x,y) coordinates of that line. If there are more than one contour, there are ways to deal with that, so it would help to have the necessary vectors and matrices in order to provide that result.
.
  댓글 수: 2
Kaden Bauernfeind
Kaden Bauernfeind 2022년 11월 11일
편집: Kaden Bauernfeind 2022년 11월 11일
Yeah its two seperate contours but Im having an issue that the X and Z dont match in size.
Star Strider
Star Strider 2022년 11월 11일
The ‘Velocity’ is a (1x21) vector.
Creating it as a matrix is straightforward —
Velocity = 1:21
Velocity = 1×21
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Vm = repmat(Velocity(:),1,200)
Vm = 21×200
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
Try it with the ‘Vm’ matrix.
.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by