Need help with a contour plot
조회 수: 2 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (1개)
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
Star Strider
2022년 11월 11일
The ‘Velocity’ is a (1x21) vector.
Creating it as a matrix is straightforward —
Velocity = 1:21
Vm = repmat(Velocity(:),1,200)
Try it with the ‘Vm’ matrix.
.
참고 항목
카테고리
Help Center 및 File Exchange에서 Contour Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!