Question

Write a function to calculate the normalized sinc This example demonstrates writing test cases for function-based...

Write a function to calculate the normalized sinc

This example demonstrates writing test cases for function-based problems. Assessment tests are designed to capture the problem requirements as well as common student errors.

The rectangular function (or square-pulse) is commonly used in signal processing applications. The Fourier transform of the rectangular function is the normalized sinc function given by:

d91aab41-4f10-4205-8907-cc0b8bc60042.png

Write a function normsinc that returns 30d19dcb-da74-4794-b3ce-21d83bc36b2b.png. Your function must:

  1. Calculate 30d19dcb-da74-4794-b3ce-21d83bc36b2b.png for each element of the input. If the input is a 1-by-4 vector, the output is also a 1-by-4.
  2. Return the value 1 when the input is 0, which is the limiting value of 59cdd939-a7bf-4116-bc6e-a162fc16ccfb.png as ef5f7744-f493-4f0f-b056-407120489944.png.

Two sample inputs are provided for you to test your code.

function y = normsinc(x)

% Implement the normalized sinc function

%code goes here

end

% Test your function before submitting

y1 = normsinc(1)

y2 = normsinc([-1 0 1/2 3/2])

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

clc

clear all

close all

y1 = normsinc(1)

y2 = normsinc([-1 0 1/2 3/2])

function y=normsinc(X)

y=[];

for x=X

if(x==0)

y=[y 1];

else

y=[y sin(pi*x)/(pi*x)];

end

end

end

Add a comment
Know the answer?
Add Answer to:
Write a function to calculate the normalized sinc This example demonstrates writing test cases for function-based...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT