Axis labels not appearing on plots

6 Ansichten (letzte 30 Tage)
Finnien Mitchell
Finnien Mitchell am 23 Mai 2020
Kommentiert: Ajay Pattassery am 26 Mai 2020
Hi, I'm trying to plot results for two sets of data and I'm having two problems. Firstly, the second (numerical) data isn't appearing and secondly none of my axis labels, legend or title is appearing either. My code for the plots is below and any hekp would be greatly appreciated.
%% Plot Section
% Analytical Vs Numerical (WD) for veritcal displacement
figure
subplot(2,1,1) %(Number of rows, number of columns, figure number)
plot(tSim, Ay, 'r--')
hold on
plot(tSim, fNWy, 'k--')
xlabel ('Time [sec]')
ylabel ('Vetical Displacement [m]')
legend('Analytical', 'Numerical (without drag)')
title('Analytical Vs Numerical (WD) for Veritcal Displacement')
hold off
  2 Kommentare
Image Analyst
Image Analyst am 23 Mai 2020
Give us data for tSim, Ay, and fNWy in a .mat file so we can run your code. Because when I run it, it looks fine:
% Make sample data:
n = 100
tSim = 1 : n;
Ay = rand(1, n);
fNWy = rand(1,n);
% Poster's code
figure
subplot(2,1,1) %(Number of rows, number of columns, figure number)
plot(tSim, Ay, 'r--')
hold on
plot(tSim, fNWy, 'k--')
xlabel ('Time [sec]')
ylabel ('Vetical Displacement [m]')
legend('Analytical', 'Numerical (without drag)')
title('Analytical Vs Numerical (WD) for Veritcal Displacement')
hold off
Ajay Pattassery
Ajay Pattassery am 26 Mai 2020
The code runs fine on my PC with assuming values for tSim, Ay and fNWy. Post if you are getting any error message so that we can help.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by