Advertisement
jukaukor

DenoisingSignal.jl

Jan 26th, 2024
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. # Signaali ja kohinan poisto, denoising
  2. # Juhani Kaukoranta 26.1.2024
  3. using KissSmoothing, Statistics,Plots
  4. X = LinRange(0, pi, 1000);
  5. Y = sin.(X.^2) .* cos.(X);
  6. p1 = plot(X,Y,legend=:topleft,lw=2,label="originaali kohinaton signaali",ylimits=(-1.2,1.2));
  7. TN = std(Y).*randn(length(X))./5; # lisätty kohinaa keskihajonta/5 verran
  8. noisy_S = Y .+ TN;
  9. # denoise poistaa kohinan N, tuottaa kohinattoman S
  10. S, N = denoise(noisy_S); #
  11. p2 = plot(X,noisy_S,legend=:topleft,color=:gray,lw=0.8,
  12. label="kohinainen signaali",ylimits=(-1.2,1.2))
  13. p3 = plot(X,S,legend=:topleft,color=:red,label = "kohinanpoiston jälkeen",ylimits=(-1.2,1.2));
  14. plot(p1,p2,p3)
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement