How Can I White Space From Both Axis in Surface Plot?

1 次查看(过去 30 天)
Hi I'm trying to remove the whitespace around some surface plots I have made:
50start.png
I have tried using linspace in both dimensions, but can only remove the white space on the x axis (appears as y axis on the image above as I've rotated the plot). My code is as follows:
amp_limits = linspace(first_amp, last_amp, num_amp);
term_limits = linspace(first_term, last_term, num_terms);
BER_mat = reshape(BER_single, num_terms, num_amp);
amp_mat = first_amp:amp_res:(last_amp-amp_res);
term_mat = first_term:2:last_term;
[amp_mat, term_mat] = meshgrid(amp_limits, term_limits);
%surface in 3D
figure;
surf(amp_mat, term_mat, BER_mat);
view(90,-90);
xlabel('Amp');
ylabel('term');
This removes the white space along the top of the image, but not on the sides. Why is this?
Thanks in advance.

采纳的回答

Star Strider
Star Strider 2019-10-21
See the axis function section on Set Axis Limits. You can set them to be whatever you want.
  2 个评论
Ted Baker
Ted Baker 2019-10-21
Thanks for the pointer. For completeness I've attached my working code below:
BER_mat = reshape(BER_single, num_terms, num_amp);
amp_mat = first_amp:amp_res:(last_amp-amp_res);
term_mat = first_term:1:(last_term/2)+0.5;
%surface in 3D
figure;
surf(amp_mat, term_mat, BER_mat);
view(90,-90);
xlabel('Amplitude (V_p_p)');
ylabel('Number of Fourier Terms');
title('BER plot');
axis([first_amp (last_amp-(amp_res)) first_term ((last_term/2)+0.5)]);
Star Strider
Star Strider 2019-10-21
As always, my pleasure!
I appreciate your posting your working code. It will help others who read this.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by