2D Graph Plot from excel data
23 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Francesco Marchione
am 20 Jul. 2021
Kommentiert: Star Strider
am 21 Jul. 2021
Hello,
I would like to plot a load-displacement graph with two curves, from excel data.
The result I would like to obtain (in terms of graphics) is that attached.
Thank you!
0 Kommentare
Akzeptierte Antwort
Star Strider
am 20 Jul. 2021
I have absolutely no idea what you want to plot, and the data posted do not give anything similar to the plot image.
Other than that, if you want to load the Excel file and plot the data, womething like this will work.
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/690238/Load-displacement.xlsx', 'VariableNamingRule','preserve')
figure
plot(T1.('s (mm)'), T1.('F (N)'))
grid
Experiment to get the result you want.
.
4 Kommentare
Star Strider
am 20 Jul. 2021
Try this —
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/690238/Load-displacement.xlsx', 'VariableNamingRule','preserve')
figure
plot(T1.('s (mm)'), T1.('F (N)'), T1.('s (mm)_1'), T1.('F (N)_1'))
grid
xlabel('F (N)')
ylabel('s (mm)')
legend('ACH_1','ACH_2', 'Location','best')
That is the best I can do with that file.
.
Weitere Antworten (1)
Francesco Marchione
am 20 Jul. 2021
1 Kommentar
Star Strider
am 21 Jul. 2021
I have no idea what you are trying to do.
There is no such thing as ‘xlabelname’ or ‘ylabelname’, only xlabel and ylabel.
Taking a wild guess —
xlabel(sprintf('Load [N]','${D_{i}}$'), 'Interpreter','latex')
ylabel(sprintf('Load [N]','${D_{i}}$'), 'Interpreter','latex')
What is the reason for the sprintf calls? They do not appear to be doing anything that the character strings themselves could do.
The revised plot call would be —
plot(T1.('s (mm)'), T1.('F (N)'), '-r', T1.('s (mm)_1'), T1.('F (N)_1'),':b', 'LineWidth',1)
.
Siehe auch
Kategorien
Mehr zu Bar Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!