필터 지우기
필터 지우기

Matlab function implement. Don't work

조회 수: 1 (최근 30일)
Charalampos Loukas
Charalampos Loukas 2017년 6월 5일
댓글: Astarag Chattopadhyay 2017년 6월 8일
I am trying to work that function in simulink model but I get errors of size mismatch and more. First object define class..
function [location_fault,err]=fault(Iaa,Ibb,Icc)
%#eml
coder.extrinsic('wrcoef');
coder.extrinsic('legend');
coder.extrinsic('num2str');
coder.extrinsic('get_param');
coder.extrinsic('str2num');
coder.extrinsic('findpeaks');
coder.extrinsic('sortrows');
persistent d;
persistent di;
double location;
char actual_fault;
double locs;
double k;
double er;
double td;
double c;
b=([1/sqrt(3) 1/sqrt(3) 1/sqrt(3)
sqrt(2/3) -1/sqrt(6) -1/sqrt(6)
0 1/sqrt(2) -1/sqrt(2)]);
IM=b*[Iaa Ibb Icc]';
Ig=IM(1,:); % Ground mode (mode 0) signal
Ia1=IM(2,:); % Aerial mode (mode 1) signal
signal=Ig;
signal_length=length(signal);
di=[];
% Perform decomposition at level 'levels' of Signal using 'type' mother wavelet,
[c,l] = wavedec(signal',3,'db5');
for i=1:3
% Reconstruct detail coefficients at 'levels=i' from the wavelet decomposition structure [c,l]
cd=wrcoef('d',c,l,'db5',i);
di=[di;cd'];
end
k=0;
for i=3:-1:1;
k=k+1;
d(k,:)=di(i,:);
end
% Reconstruct approximation at 'levels',from wavelet decomposition structure [c,l].
a=wrcoef('a',c,l,'db5',3);
MulDWT=[a';d]; % the d matrix contains the levels of decomposition
details_1=d;
signal=Ia1;
signal_length1=length(signal);
di=[];
% Perform decomposition at level 'levels' of Signal using 'type' mother wavelet,
[c,l] = wavedec(signal',3,'db5');
for i=1:3
% Reconstruct detail coefficients at 'levels=i' from the wavelet decomposition structure [c,l]
cd=wrcoef('d',c,l,'db5',i);
di=[di;cd'];
end
k=0;
for i=3:-1:1;
k=k+1;
d(k,:)=di(i,:);
end
% Reconstruct approximation at 'levels',from wavelet decomposition structure [c,l].
a=wrcoef('a',c,l,'db5',3);
MulDWT=[a';d]; % the d matrix contains the levels of decomposition
details_2=d;
%plot(details_1(1,:))
%hold on
%plot(details_2(1,:))
%legend('Ground mode','Aerial Mode')
%for three-phase fault
details_2(1,end-40:end)=0;
[pks,locs] = findpeaks(details_2(1,:)); %from aerial mode where there are no reflections from the remote-end the ocation can be found directly
data=[pks',locs'];
[k]=sortrows(data,-1); %in descending order
td=k(2,2)-k(1,2);
location=((2.89*10^5)*td*10^-6)/2;
disp(['Fault Location = ' num2str(location) ' km']) ;
actual_fault=get_param('two_remotes/Distributed Parameters Line','Length');
k=str2num(actual_fault);
er=abs(location-k);
location_fault=location;
err=er;
end
I am not sure how to define the size or class.
  댓글 수: 1
Astarag Chattopadhyay
Astarag Chattopadhyay 2017년 6월 8일
Hi,
Could you please explain in brief what functionality you are trying to accomplish through the above code and also provide the snapshots of the errors you are getting.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Continuous Wavelet Transforms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by