Create a discontinuous surface plot with 3 vectors

I have 3 vectors. z vector consists of amplitudes. Is there any provision to make the surface plot dicontinuous (between those 2 points only, then again continue with surface plot) when the jump in z vector is above some threshold value ( I tried with substituting with NaN values at such points but they are eliminating extra two points surface also). If this is not possible, can anyone helps me do this in any other convinient way? The code goes as follows
%% Surface plot pressure
y=[1:-0.048:0.856,0.832:-0.024:0.64];
x=[28:2:46];
[X,Y] = meshgrid(x,y);
for i=1:10
p_rms(:,i)=p_rmsF{i};
end
s=surf(X,Y,p_rms);
The above lines are giving me continuous surface, which I do not want

3 Comments

I am not sure if this is what you want, but here's something - You can use hold on to plot each section at a time.
Note that this is just an example. You should store all the sections in an array and use a for loop to plot all the surfaces on the same figure.
If you need more help, please attach your data (or a sample of the data if it is too large to upload), provide relevant information and ask a specific question.
%Example to show a simple idea
[X1,Y1] = meshgrid(1:5,1:20);
Z1 = sin(X1) + cos(Y1);
[X2,Y2] = meshgrid(8:10,1:20);
Z2 = sin(X2) + cos(Y2);
%Gap in the x data in the range (5,8)
figure
%plot first part
surf(X1,Y1,Z1)
%plot second part
hold on
surf(X2,Y2,Z2)
xticks(0:10)
Thank you for the prompt response, I am trying to plot more or less similar plot. However, this is very general my requirement is a little more specific i.e.this gap will come at various points which can't be done like this. I'll upload my sample soon.
Without the data, it is going to be difficult to suggest a fullproof solution to your specific problem.
Update us when you post the sample.

Sign in to comment.

Answers (0)

Products

Release

R2022a

Asked:

on 5 Aug 2023

Commented:

on 5 Aug 2023

Community Treasure Hunt

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

Start Hunting!