Hello,
I have the following problems. I have matrices: SatTrDatax_Norm (4X200) and SatTrDatay_Norm (4x50). I want to apply wavelet decomposition(wavedec) to each line separately. Next, I try to save the results to new matrices (C1,L1,C2,L2). Use for-loop but save the last value in C1,L1,C2,L2.How do I store all values resulting from the for-loop? The second problem concerns reconstruction (wrcoeff). The matrices C1,L1,C2,L2 according to the documentation must be a vector. How is this going to be done? Your help is invaluable.
for i=1:4
[C1,L1]=wavedec(SatTrDatax_Norm(i,:),3,'db1');
[C2,L2]=wavedec(SatTrDatay(i,:),3,'db1');
end
AppTrDxNorm_Sat=wrcoef('a',C1,L1,'db5',3);
D1TrDxNorm_Sat=wrcoef('d',C1,L1,'db5',1);
D2TrDxNorm_Sat=wrcoef('d',C1,L1,'db5',2);
D3TrDxNorm_Sat=wrcoef('d',C1,L1,'db5',3);
%
AppTrDySat=wrcoef('a',C2,L2,'db5',3);
D1TrDySat=wrcoef('d',C2,L2,'db5',1);
D2TrDySat=wrcoef('d',C2,L2,'db5',2);
D3TrDySat=wrcoef('d',C2,L2,'db5',3);

 채택된 답변

Shae Morgan
Shae Morgan 2020년 8월 10일
편집: Shae Morgan 2020년 8월 10일

0 개 추천

You just need to index your output and then reference the appropraite index
for i=1:4
[C1(i,:),L1(i,:)]=wavedec(SatTrDatax_Norm(i,:),3,'db1');
[C2(i,:),L2(i,:)]=wavedec(SatTrDatay(i,:),3,'db1');
end

댓글 수: 5

stelios loizidis
stelios loizidis 2020년 8월 10일
The above you mentioned to me I tried it and it shows what the following error is: Unable to perform assignment because the indices on the left side are not compatible with the size of the right
side.
for the reconstruction, you'll need to specify which vector you would like to use from your new C1,L1 and C2,L2 matrices you're making or put it in the for-loop to reconstruct each vector.
e.g.
AppTrDxNorm_Sat = wrcoef('a',C1(1,:),L(1,:),'db5',3);
would use the deconstruction of the first row of the saved C1 and L1 matrices
Like, I wrote above what you suggest does not work
for i=1:4
[C1(i,:),L1(i,:)]=wavedec(SatTrDatax_Norm(i,:),3,'db1');
[C2(i,:),L2(i,:)]=wavedec(SatTrDatay(i,:),3,'db1');
end
The following error occurs; Unable to perform assignment because the indices on the left side are not compatible with the size of the right slide.
So, I can not proceed with the reconstruction.
Shae Morgan
Shae Morgan 2020년 8월 10일
편집: Shae Morgan 2020년 8월 10일
I'm not sure what the problem is: Below works just fine for me in version 2020a
I noticed in your for-loop you call SatTrDatay rather than SatTrDatay_Norm (like you state in your question). That might be part of the problem
SatTrDatax_Norm=rand(4,200);
SatTrDatay_Norm=rand(4,50);
for i=1:4
[C1(i,:),L1(i,:)]=wavedec(SatTrDatax_Norm(i,:),3,'db1');
[C2(i,:),L2(i,:)]=wavedec(SatTrDatay_Norm(i,:),3,'db1'); %Make sure you use the right variable here
end
AppTrDxNorm_Sat=wrcoef('a',C1(1,:),L1(1,:),'db5',3);
Since you didn't provide me any of your data, I had to make up data of my own, so perhaps that's where the problem lies.
stelios loizidis
stelios loizidis 2020년 8월 10일
It is OK. There was an error in the calculations. Now everything works. Thank you very much for your valuable help !!!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

질문:

2020년 8월 10일

댓글:

2020년 8월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by