how to insert rand noise for this?

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');

 Accepted Answer

Adam Danz
Adam Danz on 11 Mar 2019
Edited: Adam Danz on 11 Mar 2019
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.

More Answers (0)

Categories

Find more on Descriptive Statistics and Insights in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!