Plotting graph with excel file

2 visualizaciones (últimos 30 días)
asd ad
asd ad el 6 de Ag. de 2020
Comentada: asd ad el 6 de Ag. de 2020
RunNo
figure (2)
plot(t(a),CAD(a),'Linewidth',2)
hold on
plot (RunNo2,CAL2,'Linewidth',2)
grid on
xlabel ('Time (s)')
ylabel ('\theta (\circ)')
title ('Contact Angle vs Evaporation Time')
legend('Theoretical','Experimental')
Time CA1 CA2
0 53.34 53.34
78 44.64 44.23
143 37 37.22
207 34.63 34.56
240 32.57 35.64
280 29.54 33.97
356 27.61 31.57
420 24.66 27.34
456 22.86 29.43
500 19.18 14.17
534 15.13 21.49
560 11.13 15.78
600 0 0
Hello everyone,
I have these values from excel and I want to plot them on matlab. When I use the plot function it just plots it as time 1,2,3,4... instead of the numbers in the data above. Furthermore, I'm using a hold on command in my plot. This is because I want to plot the experimental values above along with the theoretical values provided by the model. How do I just plot the above points on to my model at the time provided? I have attached the code to this question.
Thanks

Respuesta aceptada

Cris LaPierre
Cris LaPierre el 6 de Ag. de 2020
We'll have to make some assumptions, since we don't have all the details.
I'm going to assume your data is in a table with 3 variables, Time, CA1, and CA2. I'll assume that table is named 'Data'.
plot(Data.Time, Data.CA1)
hold on
plot(Data.Time, Data.CA2)
hold off
When you don't specify the X values in your plot command, MATLAB plots Y against it's index number (1, 2, 3, ...).

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by