I write a matlab code
x=[1 2 3 4 5 6 7 8];
n=length(x);
fs=100;
ts=1/fs;
tmax=(n-1)*ts;
t=0:ts:tmax;
plot(t,x)
f=-fs/2:fs/(n-1):fs/2;
z=fftshift(fft(x));
plot(f,abs(z));
and i got a error
??? Attempt to call constructor cell with incorrect letter case.
Error in ==> fftshift at 33
idx = cell(1, numDims);
Error in ==> Untitled at 9
z=fftshift(fft(x));
How can i solve it?

 채택된 답변

Walter Roberson
Walter Roberson 2016년 4월 18일

0 개 추천

You probably have created a file named Cell.m with uppercase C; that is interfering with use of cell()

추가 답변 (1개)

John D'Errico
John D'Errico 2016년 4월 18일

0 개 추천

It runs for me, so apparently you are running different code there, probably on a different variable x, than what you have told us.
Check the variable x. What is it? LOOK AT THE CONTENTS OF x.

댓글 수: 2

Joseph George
Joseph George 2016년 4월 18일
But i am getting that error. plz cut my program and run it in matlab. I just want to look only how the magnitude spectrum look like?? so i added just a matrix x only
Joseph George
Joseph George 2016년 4월 18일
편집: Joseph George 2016년 4월 18일
What is exactly z=fftshift(fft(x)); doing??? I got problem in this step i think.

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

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

태그

질문:

2016년 4월 18일

답변:

2016년 4월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by