How to create surface from stacked 2D plots?

조회 수: 5 (최근 30일)
DFfd
DFfd 2020년 8월 26일
댓글: Star Strider 2020년 8월 26일
I want to create a 3-d plot showing how the stability range (b_kx,b_ky) change depending on the time delay of the system (z-Axis). I can stack (b_kx,b_ky) plots by using plot3d (b_kx, b_ky, T) for each T. How can I smoothly create a surface connecting each of the individual plots?

채택된 답변

Star Strider
Star Strider 2020년 8월 26일
It would help to have your data. Lacking them, adapt this approach to your data.
This should get you started:
t = linspace(0, 2*pi, 60); % Parameter Vector
crcx = cos(t); % Circle X
crcy = sin(t); % Circle Y
rv = randi([2 10], 10, 1); % Radius Vector
crcxm = rv*crcx; % Circle X Matrix
crcym = rv*crcy; % Circle Y Matrix
figure
surf(crcxm, crcym, 2*(1:10)'+ones(size(crcxm))) % Plot Surface
grid on
axis equal
view(30,25)
shading('interp') % Optional
producing (for this random radius vector):
So with your data, create matrices from the individual circles by vertically concatenating their x and y coordinates (make them equal lengths using a common angle vector and interp1 if they are not already equal), then plot that with a z matrix created by adding a column vector of the ‘T’ values by an appropriate ones matrix as I did here. They all appear to have a common centre, so that should not be a problem.
.
  댓글 수: 2
DFfd
DFfd 2020년 8월 26일
Thanks. It worked perfectly.
Basically what I have to do is running surf(b_kx,b_ky,T+zeros(size(b_kx))) in which b_kx and b_ky are matrices with length(T) amount of columns, each column representing a set of data under one time delay setup.
Star Strider
Star Strider 2020년 8월 26일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by