Adding Noise to Signal through Rand function?
99 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Image Analyst
2020-4-10
编辑:Image Analyst
2020-4-10
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 个评论
Image Analyst
2020-4-11
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Number Theory 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!