how can I solve this error?

조회 수: 2 (최근 30일)
Kuheli Mondal
Kuheli Mondal 2016년 4월 26일
답변: John BG 2016년 4월 26일
??? Error using ==> minus Matrix dimensions must agree.
Error in ==> Full at 27 e=d-d1; My code is function x=Full(~,~,~) % sinusoid f=30; %frequency, N=20; %number of samples fs=100; %sampling frequency A=2; %amplitute n = 0:N-1; % numbering the samples x = A*sin(2*pi*f*n/fs); %primary h(3)=1; h(4)=-2.7083; h(5)=4.1861; h(6)=-3.0451; h(7)=0.73071; d=conv(h,x); %filter functin y(n) b=0.3; y = filter(b,1,x); %transfer function s(n) k=[1 0.96 0.4923]; l=[1 1.06 0.3352]; [s,w]=freqz(k,l,'whole',2000); %secondary d1=conv(s,y); %error e=d-d1; plot(e) Thank you very much.

답변 (1개)

John BG
John BG 2016년 4월 26일
Kuheli
b=0.3; a=1
means you are not really filtering, just attenuating by 0.3
where do you get the values
k=[1 0.96 0.4923];
l=[1 1.06 0.3352];
from?
the syntax of freqz is erroneous. Command freqz should have a filter object as input, not k and l.
What do you call 'whole' , and why value 2000?
you can create filter objects with the following:
dsp.AllpassFilter
dsp.AllpoleFilter
dsp.BiquadFilter
dsp.CICCompensationDecimator
dsp.CICCompensationInterpolator
dsp.CICDecimator
dsp.CICInterpolator
dsp.CoupledAllpassFilter
dsp.FarrowRateConverter
dsp.FilterCascade
dsp.FIRDecimator
dsp.FIRFilter
dsp.FIRHalfbandDecimator
dsp.FIRHalfbandInterpolator
dsp.FIRInterpolator
dsp.FIRRateConverter
dsp.HighpassFilter
dsp.IIRFilter
dsp.IIRHalfbandDecimator
dsp.IIRHalfbandInterpolator
dsp.LowpassFilter
dsp.NotchPeakFilter
dsp.VariableBandwidthFIRFilter
dsp.VariableBandwidthIIRFilter
dsp.SampleRateConverter
and the error left behind, when attempting to : e=d-d1
d has 26 real values while d1 has 2019 complex values.
If you find this answer of any help solving your question,
please click on the thumbs-up vote link,
thanks in advance
John

카테고리

Help CenterFile Exchange에서 Fixed-Point Filters에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by