How to plot graphs at distance

조회 수: 3 (최근 30일)
Kabit Kishore
Kabit Kishore 2022년 2월 8일
댓글: Voss 2022년 2월 8일
Hi. I have a n x m matrix. The first column of the matrix denotes time and the rest of the columns are responses collected at every 0.02m interval. I want to plot the (distance, the response, time) I have tried the following. However, i am getting error. Any help is appreciated. thank you.
for c = data;
[rows,cols]=size(data);
end
for ii=1:1:cols
figure(1)
z= data(:,2:ii);
time=data(:,1);
distance= 0.02*(ii-1);
figure(1)
h= plot3(distance ,data(:,2:cols),time);
view(90,90);
hold on
end

채택된 답변

Voss
Voss 2022년 2월 8일
Try it like this:
figure(1)
[rows,cols] = size(data);
time = data(:,1);
for ii = 2:cols
z = data(:,ii);
distance = 0.02*(ii-1);
h = plot3(distance*ones(rows,1), z, time);
hold on
end
% view(90,90);
xlabel('distance');
ylabel('response');
zlabel('time');
  댓글 수: 2
Kabit Kishore
Kabit Kishore 2022년 2월 8일
Thank You Benjamin. It works perfectly
Voss
Voss 2022년 2월 8일
Fantastic!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by