i want to the fft for this bp but i have this error Error using fft Invalid data type. First argument must be double, single, int8, uint8, int16, uint16, int32, uint32, or log

5 Ansichten (letzte 30 Tage)

Akzeptierte Antwort

Star Strider
Star Strider am 19 Jan. 2023
Assuming that ‘bp’ does not contain any symbolic variables, perhaps this —
FTbp = fft(double(bp));
This also assigns it to a variable to make it easier to work with later.
.
  3 Kommentare
ahmad salahat
ahmad salahat am 19 Jan. 2023
Bearbeitet: Walter Roberson am 19 Jan. 2023
syms x n t g b m z d k v p c s q bp ss
n=1:3
n = 1×3
1 2 3
w=(2*pi)/0.1
w = 62.8319
x=heaviside(t)-((t-0.05).*heaviside(t-0.05))+((t-0.1).*heaviside(t-0.1));
a0=(1/0.1)*int(x,t,0,0.1)
a0 = 
an=(2/0.1)*int(x*cos(n*w*t),t,0,0.1)
an = 
bn=(2/0.1)*int(x*sin(n*w*t),t,0,0.1)
bn = 
d=a0+an(1)*cos(w*t)+bn(1)*sin(w*t)
d = 
z=a0+an(2)*cos(2*w*t)+bn(2)*sin(2*w*t)
z = 
p=a0+an(3)*cos(3*w*t)+bn(3)*sin(3*w*t)
p = 
m=a0+an(1)*cos(w*t)+an(2)*cos(2*w*t)+an(3)*cos(3*w*t)+bn(1)*sin(w*t)+bn(2)*sin(2*w*t)+bn(3)*sin(3*w*t)
m = 
fplot(x,t)
hold on
fplot(t,m)
hold off
k=(x-d)^2
k = 
v=(1/0.1)*int(k,t,0,0.1)
v = 
fs=400
fs = 400
t=0:(1/fs):1
t = 1×401
0 0.0025 0.0050 0.0075 0.0100 0.0125 0.0150 0.0175 0.0200 0.0225 0.0250 0.0275 0.0300 0.0325 0.0350 0.0375 0.0400 0.0425 0.0450 0.0475 0.0500 0.0525 0.0550 0.0575 0.0600 0.0625 0.0650 0.0675 0.0700 0.0725
c=10*cos(2*pi*200*t)
c = 1×401
10 -10 10 -10 10 -10 10 -10 10 -10 10 -10 10 -10 10 -10 10 -10 10 -10 10 -10 10 -10 10 -10 10 -10 10 -10
plot(t,c)
s=c*p
s = 
bpFilt = designfilt('bandpassfir','FilterOrder',1000, ...
'CutoffFrequency1',200,'CutoffFrequency2',300, ...
'SampleRate',1500);
fvtool(bpFilt)
This functionality is not available on remote platforms.
dataout=filter(bpFilt,s)
Walter Roberson
Walter Roberson am 19 Jan. 2023
Your s contains symbolic values such as
sin(60*pi*t)/(6*pi) - cos(60*pi*t)/(9*pi^2) + 79/8
filter() is not able to process symbolic variables.
You cannot get fft() of symbolic variables. fft() is something that only applies to numeric data. To get a fourier transform of symbolic values you need to use fourier

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Fourier Analysis and Filtering finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by