Add white noise with 0 mean and 1 std

4 vues (au cours des 30 derniers jours)
Yovel
Yovel le 28 Déc 2022
Commenté : Walter Roberson le 28 Déc 2022
Hello,
This is my equations.
w(k) is white noise 0 mean and 0.1 std.
how do i write w(k) ?
syms x1 x2
for k=1:1:100
if k==1
x1(k)=1;
x2(k)=1;
end
x1(k+1)=x1(k)+(exp(-k))*x2(k)+w(k);
x2(k+1)=0.95*x2(k);
plot(k,x1(k),'.'); hold on
end

Réponse acceptée

Walter Roberson
Walter Roberson le 28 Déc 2022
w = @(k) randn(size(k)) ;
  2 commentaires
Image Analyst
Image Analyst le 28 Déc 2022
w = @(k) randn(size(k)) ;
% Generate an image
k = ones(15, 20);
noisyImage = w(k)
noisyImage = 15×20
-0.7810 0.1036 0.1450 -0.1242 -0.9082 -1.3220 -0.6045 0.3629 -0.2676 -0.1921 -0.0091 -0.5004 -0.4253 0.9553 0.8836 1.0848 -1.3335 0.2089 -0.7656 0.8363 0.4610 1.0027 0.2731 -2.7784 0.2441 1.4751 -2.4169 1.5512 0.0776 1.2863 -0.2897 0.7990 1.5131 1.0832 0.7598 0.1276 -0.3428 0.4942 0.0207 0.8753 -0.3790 -1.0047 1.2999 -0.2848 0.2502 -1.7495 -1.6437 -0.9650 -0.3198 -1.4467 0.2712 0.4012 0.7655 1.0376 0.3082 1.7186 0.6578 0.8142 2.0475 -0.9921 0.0434 -0.6696 0.7704 1.6930 0.4116 1.7996 -0.6179 2.5044 -0.0524 1.6719 -0.1464 -0.2351 0.2267 0.6188 1.9350 0.2987 -0.4695 0.4348 -1.7675 -0.9463 1.1573 0.4482 -1.1559 -1.6893 -0.7734 0.1444 -0.2741 -0.6408 -0.4387 -2.5542 -0.2029 1.0541 -0.7698 1.3610 -0.3446 0.8400 -0.7967 -2.2869 -0.1228 -1.4366 0.9328 0.8220 2.1294 0.2940 2.2733 2.3510 -0.7355 1.1857 1.6693 0.5286 0.0959 -0.0943 -0.4558 -1.0086 -0.8145 -0.3372 -1.3122 -0.3752 0.5183 0.6015 -1.4857 -1.0335 1.2130 0.0601 1.2628 -0.3752 1.0815 1.0309 -0.4806 0.0364 0.1153 -0.4294 0.1245 -0.5647 0.2229 0.9447 -1.2427 0.7314 1.0757 0.1191 0.4880 -1.6522 -1.5705 -2.2672 -0.8059 0.4782 -0.8197 -1.1855 -1.4402 0.9377 -0.1491 1.8360 -0.0808 0.8838 -0.1365 1.2182 -0.5812 -1.4240 1.6505 0.7840 1.0893 0.5928 -0.5563 -0.2506 0.4924 1.2383 0.5349 0.7785 0.2878 2.0619 0.6695 -1.3376 -0.3346 0.3277 0.6791 0.3253 -1.6830 -0.1535 -0.7157 -0.1444 0.7894 -1.6131 -0.1647 -0.4107 2.8196 -0.1712 1.3158 0.2098 -1.7310 0.3945 -0.0196 -0.1790 -0.7076 0.9815 -1.1711 -0.1627 -0.2817 0.6665 -1.0187 -0.2875
imshow(noisyImage, []);
axis('on', 'image');
fprintf('Mean = %g, StdDev = %g.\n', mean2(noisyImage), std2(noisyImage))
Mean = 0.00566259, StdDev = 1.01108.
Walter Roberson
Walter Roberson le 28 Déc 2022
w = @(k) randn(size(k)) ;
syms x1 x2
for k=1:1:100
if k==1
x1(k)=1;
x2(k)=1;
end
x1(k+1)=x1(k)+(exp(-k))*x2(k)+w(k);
x2(k+1)=0.95*x2(k);
plot(k,x1(k),'.'); hold on
end

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by