Digitization of noisy signal

5 views (last 30 days)
suman Dhamala
suman Dhamala on 20 Feb 2018
Commented: Star Strider on 21 Feb 2018
I have a signal as shown in the image here. I am trying to digitize the signal so that it catches the right jump only. My system is jumping between two states with noise. I want to calculate how much time it stays up and how much down. Could you please bring a super cool idea? Thanks for your help

Accepted Answer

Star Strider
Star Strider on 20 Feb 2018
If your have version R2016a or later of the Signal Processing Toolbox, use the findchangepts (link) function.
  8 Comments
suman Dhamala
suman Dhamala on 21 Feb 2018
Edited: suman Dhamala on 21 Feb 2018
Hi Star Strider,
I also tried it and figure out the problem was on the decimal number. I fixed it, can you please try it. Thanks
phi(1)=0.66702; phi(2)= 0.667003; phidc(1)=0;phidc(2)= 0.00001;
for n=2:10^5 ;
p= 0.5.*rand-0.25; q = 1.*rand -0.5 ;
phi(n+1)= 0.0031+ 1.9676*phi(n) -0.9686*phi(n-1)- 0.0039*cos( 0.5*phidc(n))* sin(phi(n)) + 0.0390* q ;
phidc(n+1)= 1.8873*phidc(n) -0.9686*phidc(n-1)- 0.0079*sin(0.5*phidc(n))* cos(phi(n)) + 4*0.0390* p ;
end
figure(1110)
plot(phi)
Star Strider
Star Strider on 21 Feb 2018
Try this:
t = 1:numel(phi);
ipt = findchangepts(phi, 'MinThreshold',1000, 'Statistic','std');
figure(1110)
plot(t, phi)
hold on
plot([t(ipt(1:2:end)); t(ipt(1:2:end))], [zeros(1,numel(ipt(1:2:end))); 5*ones(1,numel(ipt(2:2:end)))], '-r', 'LineWidth',1.5)
hold off
It plots vertical lines at the transitions.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!