why I cant run this program?
이전 댓글 표시
function x=signal(f,fs,N)
% sinusoid
f=30; %frequency,
N=10; %number of samples
fs=100; %sampling frequency
A=2; %amplitute
Total sampling time = 1 second
n = 0:N-1; % numbering the samples
x = A*sin(2*pi*f*n/fs);
plot(x)
MFx = abs(fft(x));
frek=(0:N/2-1)*fs/N;
plot(frek,MFx(1:N/2))% plot the positive frequencies
please help me.
thank you
댓글 수: 4
John D'Errico
2016년 3월 30일
What did you try? What did MATLAB do when you tried to use it? Oh, and tell me that you did NOT try to use the run command on it. You don't "run" functions.
Image Analyst
2016년 3월 30일
Did you type F5, or click the green run triangle on the tool ribbon? If you did that, you'll need a test script to make arguments and call signal() because you can't run signal() without suppyling arguments.
Or did you supply arguments in the command window?
Kuheli Mondal
2016년 3월 31일
Muhammad Usman Saleem
2016년 3월 31일
fine. Then please accept my answer. if you would like
채택된 답변
추가 답변 (1개)
Image Analyst
2016년 3월 31일
0 개 추천
Kuheli, the attached m-file (below the plot) runs perfectly fine. It runs via the green run triangle, and it runs via typing F5. AND it runs with no errors at all and makes the plot below. It's all in one m-file, text3.m and is attached. If you can't run it, let me know, otherwise you can Accept this answer.

카테고리
도움말 센터 및 File Exchange에서 Signal Attributes and Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!