MatlabScript for adding Gaussian Noise
古いコメントを表示
Please I have been able to fix my script but ran into an error. Attached is the script for adding a Gaussian Noise to a signal and extracting the features
%% clear
load('John_3PhaseFault0ohm.mat')
%% does this signals has any NaNs, if so remove
SteadyStateNoneFaultState = rmmissing(SteadyStateNoneFaultState);
Data3Phase0hmsFaultData = rmmissing(Data3Phase0hmsFaultData);
SSTime = SteadyStateNoneFaultState.Time;
SSNFS = SteadyStateNoneFaultState.SteadyStateNoneFaultState;
DPTime = Data3Phase0hmsFaultData.Time;
DPFD = Data3Phase0hmsFaultData.Data3Phase0hmsFaultData;
%% Feature extraction section
for k=1:level+1
signals = Data3Phase0hmsFaultData;
reqSNR = [15]; %noise in dB
sigEner = norm(signals(:,k))^2; % energy of the signals
noiseEner = sigEner/(10^(reqSNR/10)); % energy of noise to be added
noiseVar = noiseEner/(length(signals)); % variance of noise to be added
ST = sqrt(noiseVar); % std. deviation of noise to be added
noise = ST*randn(size(signals)); % noise
noisySig = signals+noise; % noisy signals
end
% Plot & Observe the data
subplot(2,1,1)
plot(noisySig);
title('Noise Signal')
subplot(2,1,2)
plot(noise);
title('Noise')
%% Let's observe the FFT power spectrum for differences
feat_fault = getmswtfeat(noisySig,32,16,100000);
Error
>> Noisysig
Unrecognized function or variable 'level'.
Error in Noisysig (line 11)
for k=1:level+1
>>
10 件のコメント
Walter Roberson
2022 年 11 月 30 日
Are you expecting level to be loaded from John_3PhaseFault0ohm.mat ? If not, then where are you expecting its value to come from?
john amoo otoo
2022 年 11 月 30 日
Walter Roberson
2022 年 11 月 30 日
Ah but your code uses level with a lower case L but the mat has Level with an uppercase L
john amoo otoo
2022 年 11 月 30 日
john amoo otoo
2022 年 11 月 30 日
Walter Roberson
2022 年 11 月 30 日
for dims =1:Nsignals
signals = Data3Phase0hmsFaultData;
for dims =1:Nsignals
Notice that the second for loop is the same as the first one. You do not have an end corresponding to the first version of the loop.
john amoo otoo
2022 年 12 月 1 日
john amoo otoo
2022 年 12 月 1 日
john amoo otoo
2022 年 12 月 1 日
編集済み: Walter Roberson
2022 年 12 月 1 日
Walter Roberson
2022 年 12 月 1 日
What difficulty are you encountering with the code you have that you commented out?
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Filter Banks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!