Plotting a graph properly
Afficher commentaires plus anciens
%code for plotting the real values of wetted radius vs time
WR_real = real(WR);
WR_real(valid) = 0;
plot(timeSec(:,:,1),WR_real(:,:,1),'LineWidth',2)
xlabel ('Time (s)')
ylabel ('Wetted Radius (m)')
title ('Wetted Radius vs Evaporation Time')
legend('Theoretical')

Hello everyone,
I want to plot a graph and I used the attached code. However, I want to get rid of the vertical blue line on the y axis and the horizontal blue line on the x axis. I am not quite sure how this happened. Does anyone know how to solve this problem?
Thanks and regards
1 commentaire
KSSV
le 22 Juil 2020
You skip the first value and then plot.
Réponse acceptée
Plus de réponses (1)
Arthur Roué
le 22 Juil 2020
Modifié(e) : Arthur Roué
le 22 Juil 2020
This happens because your data looks like that :
WR_real(:,:,1) = [0 1.1 ... 0.2 0 0]*1e-3
To get rid of those lines, remove the zeros at the beginning and the end of your data (and in time vector too to match size)
2 commentaires
AB
le 22 Juil 2020
Arthur Roué
le 22 Juil 2020
Modifié(e) : Arthur Roué
le 22 Juil 2020
In your case, it seems the zeros are only at the end and beginning. Then you can remove all 0 this way :
% Get index of 0
vb = WR_real(:,:,1) ~= 0
% Plot without the 0
plot(timeSec(vb,:,1),WR_real(vb,:,1),'LineWidth',2)
EDIT : Why WR_real got 3 dimension ?
Catégories
En savoir plus sur Title dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
