I am not getting a linear plot, how can I get a plot that consist all the data points?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Star Strider
2022-6-7
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.
.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!