
Adding Noise to Signal through Rand function?
55 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Syed Adeel
le 10 Avr 2020
Commenté : Image Analyst
le 11 Avr 2020
Hello everyone, I just want a simple help as I am new to matlab.
I want to add Noise to my Signal through rand function but its giving error. Kindly if anyone can see how am i doing it wrong. Thoguh its just few lines from a long code which works perfectly without this noise addition.
noise = 2*rand (size(time));
y2t=noise+y22t; // y22t is the signal
plot(time*1e9,y2t,'-k','LineWidth',2);
xlabel('Time - [ns]');ylabel('Amplitude - [V]');
hold on;
grid on;
0 commentaires
Réponse acceptée
Image Analyst
le 10 Avr 2020
Modifié(e) : Image Analyst
le 10 Avr 2020
Try this:
t = 1 : 50; % Whatever.
y22t = 2 * sin(2 * pi * t / 15);
subplot(2, 1, 1);
plot(t, y22t, 'b-', 'LineWidth', 2);
grid on;
xlabel('Time - [ns]', 'FontSize', 15);
ylabel('ytt', 'FontSize', 15);
title('Noise-free y22t', 'FontSize', 15);
noise = 2*rand (size(t)); % To go on both sides of the signal, use 2*rand (size(t)) - 1
y2t=noise+y22t; % y22t is the signal
subplot(2, 1, 2);
plot(t,y2t,'-k', 'LineWidth',2);
xlabel('Time - [ns]', 'FontSize', 15);
ylabel('Amplitude - [V]', 'FontSize', 15);
title('Noisy y22t', 'FontSize', 15);
hold on;
grid on;

Don't use time as the name of your variable since it's the name of a built-in function.
2 commentaires
Image Analyst
le 11 Avr 2020
Yes, 2 is the amplitude of the noise. It can be whatever you want.
Sorry I can't help with the second part. I don't have the Symbolic Toolbox and haven't dealt with Lalace Transforms since I was an undergraduate many decades ago.
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
