Plot vectors must be same length
显示 更早的评论
fileName='ExtractedDataandGraphs.xlsx';
data=xlsread(fileName);
t=1.5; w=1.27; l=4.49;
A=w*t;
time=data(1:24,2);
u=0.449;
F=data(1:24,3);
sigma=F/A;
fig0=figure;
plot(time,F); xlabel('time (s)'); ylabel('Force (MPa)');
fig1=figure;
h11=subplot(3,1,1);
plot(time, sigma);
xlabel('time (s)'); ylabel('stress (MPa)');
title('Cartilage');
%removing ramp
[maxS, idxMax]=max(sigma);
t1=time(idxMax:end);
t1=t1-t1(1);
sigma1=sigma(idxMax:end);
fig2=figure;
h12=subplot(3,1,2);
plot(t1,sigma1); legend('sigma from data');
xlabel('time (s)'); ylabel('sigma (MPa)');
%variable creation
xdata=t1;
ydata=sigma1;
%fitting function
fun2fit=@(params, time) params(1)*exp(-params(2)*t1)+params(3);
%guess parameters
guess=[100,40,10];
funGuess=fun2fit(guess,time);
plot(time,funGuess);
I have tried everything and looked at so many other forums. I cannot figure out what is wrong with this and why ot wont complete the last plot function.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!