how to insert rand noise for this?

1 次查看(过去 30 天)
filename = 'hafis.CSV';
M = csvread(filename);
N=100;
x=M(:,3);
Y=M(:,4);
N=100;
subplot(2,2,1)
plot (x,Y,'linewidth',2)
title('Arc Signal')
xlabel('TIME')
ylabel('VOLTAGE');

采纳的回答

Adam Danz
Adam Danz 2019-3-11
编辑:Adam Danz 2019-3-11
You can use rand() to produce a vector (or matrix/array) of random values between 0:1. I subtracted 0.5 from those random numbers to center them around 0. Then I scaled them by a factor of 2 to demonstrate how to scale the random noise. Then simply add the noise to your data.
xrand = (rand(size(x))-0.5) * 2;
yrand = (rand(size(Y))-0.5) * 2;
plot (x + xrand, Y + yrand, 'linewidth', 2)
By the way, you defined N twice in your code.

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by