Can someone please help me do this problem?

The sinc function is very important in digital signal processing as it is the Fourier transform of a rectangular pulse and is used extensively in interpolation. The sinc function is given by: sinc(t)= sin(π t)/(π t) when t ≠0 sinc(t)=1 when t=0 We will graph the sinc function in 3D to understand better its shape. Write a script that creates a plaid of x and y values that vary between -5 to 5. Choose an adequate step size. Calculate r which is given by: r= √(x^2+ y^2 ) Then, plot using x, y, and sinc(r) using a mesh plot. You can either write your own function for sinc or use MATLAB’s built in function. Include your code and plot below. Skills – 3D mesh plots in MATLAB, meshgrid.

1 comentario

Rehab Mohamed`
Rehab Mohamed` el 15 de Mzo. de 2017
Editada: Rehab Mohamed` el 15 de Mzo. de 2017
I started with these equations, but i don't know if that's right or not x= -5:1:5; y= -5:1:5; r= sqrt(x.^2 +y.^2);

Iniciar sesión para comentar.

 Respuesta aceptada

Star Strider
Star Strider el 16 de Mzo. de 2017
You have to adapt your ‘sinc’ function to use ‘r’ rather than ‘t’, and use element-wise division. Use the meshgrid function to create the appropriate ‘X’ and ‘Y’ matrices to calculate ‘r’.
Define ‘x’ and ‘y’ as:
x= -5:0.1:5;
y= -5:0.1:5;
to get acceptable resolution in the plot.

6 comentarios

Rehab Mohamed`
Rehab Mohamed` el 16 de Mzo. de 2017
I did two codes but none of them is working however, the first one worked but i don't know why it is not working again!! 1. x= -5:1:5; y= -5:1:5; [xx,yy]=meshgrid(x,y); r= sqrt(xx.^2 +yy.^2); mesh(xx,yy,sinc(r))
2. [X,Y]=meshgrid(-5:1:5); R= sqrt(X.^2 + Y.^2); Z= sin®./R; mesh(X,Y,Z)
Your second code works. You need to make two changes:
[X,Y]=meshgrid(-5:0.1:5); % Use A Mesh With A Smaller Step Increment
R= sqrt(X.^2 + Y.^2);
Z= sin(pi*R)./(pi*R); % Multiply By ‘pi’
mesh(X,Y,Z)
That will give you the result you want.
Rehab Mohamed`
Rehab Mohamed` el 17 de Mzo. de 2017
I did that, but it is not running ! that's the error that appears each time I try to run it, (Error in mesh2 (line 4) mesh(X,Y,Z)
Star Strider
Star Strider el 17 de Mzo. de 2017
The code I posted runs without error.
You did not say what the error is that you are getting.
Rehab Mohamed`
Rehab Mohamed` el 17 de Mzo. de 2017
Oh ok, i figured out what was wrong. thanks for your help
Star Strider
Star Strider el 17 de Mzo. de 2017
My pleasure.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Animation en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 15 de Mzo. de 2017

Comentada:

el 17 de Mzo. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by