0
votes

I would like to add a reference line on a 3d plot which follows the surface built with mesh(). I have 3 points in the x and y axis to build the line and so will need to interpolate to find z axis coordinates. Here is my code (with reproducible data) so far:

acceleration_dB = [0 109.3699 118.0084 133.9584 104.3017 110.5423 120.6332 140.6567 144.4194 129.7292]';
frequency = [1 50 50 50 100 100 100 100 100 500]';
voltage = [ 1.0e-04 * 0.0001 0.0968 0.1645 0.2983 0.0278 0.0368 0.0893 0.2785 0.4928 0.0780 ]';
xlin=linspace(0, max(frequency),33);
ylin=linspace(min(acceleration_dB), max(acceleration_dB),33);
[X, Y] = meshgrid(xlin,ylin);
f = scatteredInterpolant(frequency,acceleration_dB,log(voltage));
Z=f(X,Y);
figure();
mesh(X,Y,Z);
hold on

% Add threshold reference line
threshAccel = [97.0870 104.4212 109.5787]
threshFreq = [50 100 500]
Zthresh=f(threshFreq,threshAccel);
plot3(threshFreq,threshAccel,Zthresh,'Color','black','LineWidth',1)

Which gives:

3dplot

What I would like is the black line following the plane of the surface for the whole length of the x-axis.

Any advice would be greatly appreciated. Thank you!

1
The coordinates I have to build this line are [10,97.0870] [100, 104.4212] [500, 109.5787] on the x and y axis. I would like to extend this line to go from the minimum limits of the frequency axis (0 - 500) but also to follow the relief of the 3d surface.user3406207
Did you try to add more points to threshAcceland threshFreq?shamalaia
Yes, it seems to be what I need to do, i.e. add more points to threshAcceland threshFreq and also get their corresponding coordinates in the z plane (so that the line actually is not 'floating' above the mesh. But I don't know how to do this. Some kind of 3d interpolation?user3406207
how did you obtain threshAccel and threshFreq in the first place? If you do not have an analytical expression you could interpolate the three points and then calculate the new threshAccel and threshFreq using the fit parameters.shamalaia

1 Answers

1
votes

It is just a problem of range I think. This seems to work pretty well:

   threshAccel = [97 97.0870 104.4212 109.5787]
    threshFreq = [0 50 100 500]

but I am not sure about that 97 and 0 are the precise values. You should correct them probably.