Why do I recieve error when doing sinc function

Im trying to plot the sinc function and im given my A and T however when i try to input the equation i get an error
A = 1;
T = 1;
gf= AT sinc(fT);

댓글 수: 2

Jon
Jon 2022년 1월 25일
Please copy and paste the full error message, all of the red text, so we can see what error you are getting.

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

답변 (2개)

Jon
Jon 2022년 1월 25일
If you want to plot the sinc value for a range of values then you need to pass it a vector of values.
So for example:
x = linspace(-10,10,1000); % defines a vector with a thousand equally spaced points between -10 and 10
y = sinc(x);
plot(x,y)
You will need to modify with your actual values and scaling constants

댓글 수: 3

The plot shown in your figure is of the absolute value of the sinc function. Also it looks like it goes out to x = f/T of about 4 so this would probably look close
x = linspace(-4,4,1000); % defines a vector with a thousand equally spaced points between -10 and 10
y = abs(sinc(x));
plot(x,y)
By the way the error message you are getting is because you didn't have a multiplication operator. You need to have something like:
gf = A*T*sinc(ft)
This would have then given another error, because you have not yet defined ft
Jon
Jon 2022년 1월 25일
If you are still just trying to get the basics of using MATLAB I would suggest completing the MATLAB on-ramp https://www.mathworks.com/learn/tutorials/matlab-onramp.html

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

Yusuf Suer Erdem
Yusuf Suer Erdem 2022년 1월 25일
Hi, try it this way. That is the way how it should be done. But I could not get the exact waveform. Maybe others could help.
t = linspace(-5,5);
f=1./t;
A=5;
y = A.*t.*sinc(f.*t);
plot(t,y)
grid

카테고리

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

제품

질문:

2022년 1월 25일

댓글:

Jon
2022년 1월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by