Fitting exponential
19 ビュー (過去 30 日間)
古いコメントを表示
Hi, I want to fit my data with an exponential curve. I use fit and fittype=exp. So far no problem. But now I only want to use the first 600 data points and the last 200 datapoints (every trace has 15000 datapoints) and make an exponential fit over the whole trace only using this datapoints.
Can anybody help me which methods to use?
Thanks for your efforts!
2 件のコメント
Rick Rosson
2011 年 8 月 4 日
Are you asking for help with which methods to use for curve fitting, or are you asking for help in how to segregate the data in MATLAB into two separate sets of data?
採用された回答
Rick Rosson
2011 年 8 月 4 日
I will assume that you have the 15,000 data samples stored in the MATLAB Workspace as a 15,000 x 1 column vector called dataset.x.
%%Create time domain:
N = size(dataset.x,1);
Fs = 125;
dt = 1/Fs;
dataset.t = dt*(0:N-1)';
%%Create subset:
p = 600;
q = 200;
subset.x = [ dataset.x(1:p) ; dataset.x(end-q+1:end) ];
subset.t = [ dataset.t(1:p) ; dataset.t(end-q+1:end) ];
%%Exponential fit:
fitType = 'exp1';
myFit = fit(subset.t,subset.x,fitType);
HTH.
Rick
3 件のコメント
the cyclist
2011 年 8 月 4 日
Not that I'm bitter or anything, but ... uh ... isn't this exactly what I proposed in my answer? (Except that you did the work for him?)
その他の回答 (3 件)
the cyclist
2011 年 8 月 4 日
If "x" is your explanatory variable, then it should be as simple as using x([1:600,end-199:end]), do similar for your response variable,and run fit() just as you did with "no problem" before. Or is it more complicated than that?
0 件のコメント
fcarl
2011 年 8 月 4 日
5 件のコメント
Rick Rosson
2011 年 8 月 4 日
Also, what is your time scale? You have 15000 points, but I assume that the time increment is not actually 1, but something much smaller. Do you know the sampling rate Fs and/or the time increment dt = 1/Fs?
参考
カテゴリ
Help Center および File Exchange で Descriptive Statistics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!