How to smooth seasonal averages into a continuous function?
3 ビュー (過去 30 日間)
古いコメントを表示
Hi, I have a system of four non linear ordinary differential equations:
dy(1,1) = (k1(t).*(y(4)-y(1)).*y(3))./(y(2)+y(3)-1e-12) - k2(t).*y(1).*(y(2)./(y(2)+y(3)-1e-12)) ;
dy(2,1) = (mu(t).*(y(2).^2)/(K(t).^2+y(2).^2)).*exp((-y(1)).*k(t))-(k3(t).*y(1).*y(2))./(y(2)+y(3)-1e-12)-(d1(t)+gamma1(t).*y(4)).*y(2);
dy(3,1) = (k3(t).*y(1).*y(2))./(y(2)+y(3)-1e-12)-(d2(t)+gamma2(t).*y(4)).*y(3);
dy(4,1) = r(t).*y(4).*(1-(y(4)./(alpha(t).*(y(2)+y(3)-1e-12))));
% Nested k1
function y = k1(t)
y = [0.1593,0.1460,0.1489,0.04226];
idx = logical(histc(t,[0,91.25,182.5,273.75,365]));
y = y(idx);
end
% Nested k2
function y = k2(t)
y = [0.04959,0.03721,0.04750,0.008460];
idx = logical(histc(t,[0,91.25,182.5,273.75,365]));
y = y(idx);
end
There are 12 parameters(like k1,k2 and so on) involved in the model and they are known as their seasonal averages in the literature. I want to construct continuous functions from the seasonal averages by using interpolation/approximation. I have no idea where to start from! Your guidance, comments, reference to any book or code will be greatly appreciated. Thanks
2 件のコメント
Jan
2013 年 3 月 25 日
The question is not clear. Actually the posted code does not concern theproblem at all, when I understand correctly, but you only want a continuos function to approximate your k1(t) to k12(t). So please post the available values of these parameters and explain, which function should be used for fitting.
採用された回答
Image Analyst
2013 年 4 月 13 日
Use conv() to get a sliding average
seasonalAverage = conv(dailyData, ones(1,90)/90);
You should pad your signal on both sides with copies of the year's data so that you get continuous wrap around averaging and not get any "edge effects" when the 90 day window overlaps the edge. For example if the window goes from Dec. 1 to Feb. 28, you want to make sure you have some data there in December.
Make sense?
2 件のコメント
Image Analyst
2013 年 4 月 14 日
There are tons of web sites discussing convolution - it's the basis for linear filtering. If you just want to replicate constants then use repmat(), for example to get a year's worth:
seasonalMeans = ones(1,365);
seasonalMeans(1:91) = seasonalMeans(1:91) * winterMean;
seasonalMeans(92:182) = seasonalMeans(92:182) * springMean;
and so on.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!