I am not getting a linear plot, how can I get a plot that consist all the data points?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Manav Divekar
el 7 de Jun. de 2022
Comentada: Star Strider
el 7 de Jun. de 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 comentarios
Respuesta aceptada
Star Strider
el 7 de Jun. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Distribution Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!