Normalize x-axis and y-axis of surface plot

I created a matlab code to calculate the cross ambiguity function. The results are correct, but the problem I am facing that the doppler and delay values are from 0 to 400, and the peak is centered at 200.
I am just wondering how can I normalize the x-axis (delay) and y-axis(doppler) of the surface plot to have the peak centered at 0?

 Accepted Answer

Call surf with 3 inputs not just 1.
[x, y, z] = peaks;
figure
surf(z)
title('1 input')
figure
surf(x, y, z)
title('3 inputs')

4 Comments

Thanks!
I have one more question please.
Is there anyway to convert the surface plot (attached) to two plots; (X,Z) and (Y,Z)?
I'm only guessing what you mean by (X, Z) and (Y, Z) but perhaps changing the view of the axes may do what you're looking for?
makesurface % Default view
makesurface; view(0, 90) % x and y, looking down the z axis
makesurface; view(0, 0) % x and z, looking down the y axis
makesurface; view(90, 0) % y and z, looking down the x axis
function makesurface
figure
[x, y, z] = peaks;
surf(x, y, z);
xlabel('x')
ylabel('y')
zlabel('z');
end
Thank you so much!
I meant by (X,Z) that I need to plot the X-axis (delay) with Z-axis (the ambigiuty function) .
Similarly, the (Y,Z) means plotting the Y-axis (doppler) with Z-axis(the ambigiuty function)).
I suspect you have matrices of x, y, and z data (like what was returned by the peaks function in my example above.)
[x, y, z] = peaks;
whos
Name Size Bytes Class Attributes x 49x49 19208 double y 49x49 19208 double z 49x49 19208 double
So what specifically do you mean by "plot the X-axis with Z-axis"? For the peaks data, what do you want to plot? Do you want to turn them into a vector?
plot(x(:), y(:))
figure
plot(x(:), z(:))
figure
plot(y(:), z(:))
Or do you want the view-based approach I showed earlier? Or did you have something else in mind?

Sign in to comment.

More Answers (0)

Products

Release

R2020a

Community Treasure Hunt

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

Start Hunting!