how to insert rand noise for this?

1 vue (au cours des 30 derniers jours)
hafis radzi
hafis radzi le 11 Mar 2019
Commenté : hafis radzi le 11 Mar 2019
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');

Réponse acceptée

Adam Danz
Adam Danz le 11 Mar 2019
Modifié(e) : Adam Danz le 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.
  1 commentaire
hafis radzi
hafis radzi le 11 Mar 2019
i already got it sir,tq.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by