I am simulating a problem where a wave is incident upon a multi-layered sphere.
I have a variable named forceZ1
which is a function of two other variables named phase
and frequency
. I have solved an equation and found the matrix for forceZ1
. Also I know that frequency
is a 1*3000 matrix and phase
is the same size. So obviously forceZ1
will be 3000*3000.
In this case the phase is changing between 0
and 2*pi
and based on the data, I got that the force should be periodic with a period of 2π. This can be verified by plotting any column vector in forceZ1
with respect to the angle, e.g.
figure(); plot(ang1, forceZ1(:,567));
Which gives:
I tried to draw a surface forceZ1
vs. frequency
and phase
but the figure does not show the periodic behavior. What am I doing wrong?
Here's my plotting code:
Z=forceZ1;
X=ang1;
Y=frequency;
figure
surf(X,Y,Z,'edgecolor','none')
shading interp
view(3)
xlim([0,2*pi]);
xlabel('X=phase')
ylabel('Y=nondimensional frequency')
zlabel('Z=force in Z direction')
title('Force-Frequency-Phase')
colormap jet
I uploaded a .mat
file of my data for your reference.
It seems like your forceZ1
matrix got transposed somewhere along the way. The data is indeed periodic, as you said, but the direction of the periodicity is your Y axis.
It will start making sense if you plot your data like this:
surf(X,Y,Z.','edgecolor','none');
... leading to:
However, since your data contains harmonics differing by phase, magnitude and offset, you might want to try using a different type of chart that would accentuate the shapes of the harmonics, such as ribbon
:
figure(); ribbon(Z(1:40:end,1:100:end));
... or try to make an animation, or an interactive chart using a slider for the shown frequency.
Also, it's possible that your data wasn't just transposed, but also flipped so you might need to use flip
to get the correct result.