How to plot a 3D graph.

This is my code to create a 3D graph from three columns of info in excel. The code draws a graph fine but when I looked closer I realised that many of the peaks on the graph were much smaller than the actual numbers or some large peaks did not exists at all. Can anyone tell me why
%% Step 1: Create equally-spaced vectors of x and y coordinates.
x = linspace(min(Speed), max(Speed), 50);
y = linspace(min(Acceleration), max(Acceleration), 50);
%% Step 2: Create matrices of all lattice points.
[X, Y] = meshgrid(x, y);
%% Step 3: Interpolate and create the surface.
F = TriScatteredInterp(Speed, Acceleration, Frequency);
% Takes the raw data, and produces an interpolant.
Z = F(X, Y); % Evaluates this interpolant at every lattice point.
%% Step 4: Visualise.
figure
surf(X, Y, Z)
shading('interp')
grid on
xlabel('Speed (km/h)')
ylabel('Acceleration (m/s/s)')
zlabel('Frequency')

回答(0 个)

类别

帮助中心File Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by