Surface plot from dataset not dependent on X and Y

Hi i am generating a wave hight interpolation by the code below and want to make a surface plot over time.
but when i try to plot the surf plot it takes all the 6000 interpolatet lines and plots them in one plane 6000 times over the time series.
i do not know if i the surf plot only works with a Z dependent on X and Y directly?
load('data_3D_plot.mat') % loading wave data
%%
clc
Ts = 0.02;
time = (0:1:6000-1)*Ts;
d = [0 50 100 150 200]; % point across the bassin
xq = (0:0.1:200); % setps across
v= zeros(6000,5);
for i=1:length(time)
v(i,1:5) = [MonoHeight005Period3685Sensor2(i,1) MonoHeight005Period3685Sensor2(i,1) MonoHeight005Period3685Sensor2(i,2) MonoHeight005Period3685Sensor2(i,3) MonoHeight005Period3685Sensor2(i,3)];
vq(i,1:2001) = interpn(d,v(i,:),xq,'spline');
end
do i need to alter the code for generating the vq matrix or can it be done whit che code at hand?
thanks for the help

 採用された回答

Walter Roberson
Walter Roberson 2021 年 11 月 8 日

0 投票

plot(time, vq.')

6 件のコメント

daniel tarp
daniel tarp 2021 年 11 月 12 日
thanks for the answer but this only gives a plot of 6000 curves in a single plane, i would like to have it as a surfaceplot over time.
each row in vq is at one timestep and i want to have them connected with a surface.
Walter Roberson
Walter Roberson 2021 年 11 月 12 日
Something like a ribbon plot or a waterfall plot? or just surf() ?
daniel tarp
daniel tarp 2021 年 11 月 12 日
i would like to have it as a surf plot as it is wave data over time.
i have 5 wave gauges over a 200 cm span of water and messuring the wave hight then i interpolated over these 5 points at each timestep to get vq which then is a matrix of function values, where each row is at one time step.
Walter Roberson
Walter Roberson 2021 年 11 月 12 日
surf(xq, time, vq)
daniel tarp
daniel tarp 2021 年 11 月 14 日
that gives me the plot below and it looks like it is all 6000 lines in each time step
Walter Roberson
Walter Roberson 2021 年 11 月 14 日
I recommend adding 'edgecolor', 'none' to the surf() call.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

製品

リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by