how to maintain continuity and periodicity of a function

조회 수: 2 (최근 30일)
Rose
Rose 2013년 6월 24일

I have a parameter (piece wise constant over each season of the year). I used 'pchip' to interpolate this function:

 function y  =  mu(t)
         xl = [0 23.3125 46.625 69.9375 114.5625 137.875 161.1875 205.8125 229.125 252.8125 297.0625 320.375 343.6875 365 ];
         yl = [500 500 500 500 1500 1500 1500 500 500 500 0 0 0 0 ];
           y = pchip(xl,yl,t);
end

I used mod to make it periodic with a period of 365 days:

M = mu(mod(tspan,365));

But i get a discontinuous and non-periodic function while going from t=364 to t=365. How can i make this function continuous and periodic? I didn't know how to attach a jpg file to my question, otherwise i would have attached a picture showing the function $mu$. Any kind of help will be appreciated.

답변 (1개)

Iain
Iain 2013년 6월 25일
Try ensuring that your fit wraps around - ie, that you give it x = 366 and y = the value it has when x = 0.
  댓글 수: 2
Rose
Rose 2013년 6월 25일
Hi, thanks for the reply. Can you please elaborate more?
Iain
Iain 2013년 6월 25일
I am saying that if you expand your curve to "look like" it continues on both ends, then your fit will be much more likely to be periodic.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by