I am not getting a linear plot, how can I get a plot that consist all the data points?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Manav Divekar
il 7 Giu 2022
Commentato: Star Strider
il 7 Giu 2022
I want to plot from the excel sheet from table F1:I31 but the matlab is not taking all the data and plotting. the does not seem correct
dataset = xlsread('Problem1.xlsx','Sheet1','F1:I31');
x = dataset(:,2);
y = dataset(:,3);
z = dataset(:,4);
figure
plot(x,y,'r');
xlabel('time');
ylabel('displacement');
title('U1');
figure
plot(x,z);
xlabel('time');
ylabel('displacement');
title('U2');
0 Commenti
Risposta accettata
Star Strider
il 7 Giu 2022
You are asking it to read 30 rows across 4 columns, and it is doing exactly that —
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1024315/Problem1.xlsx','Sheet',1, 'Range','F1:I31', 'VariableNamingRule','preserve')
dataset = table2array(T1);
x = dataset(:,2);
y = dataset(:,3);
z = dataset(:,4);
figure
plot(x,y,'r');
set(gca, 'YScale','log') % <— ADDED
xlabel('time');
ylabel('displacement');
title('U1');
figure
plot(x,z);
set(gca, 'YScale','log') % <— ADDED
xlabel('time');
ylabel('displacement');
title('U2');
To get a plot that appears to be linear, plot the logarithm of the dependent variable.
.
2 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Data Distribution Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!