How can I get a sinc function like this?

As we know there is a sinc function in matlab which calculates the sinc of the data. But I need to
get a sinc function that look like the image.
what mathematical properties should I change to turn the standard sinc function into one like this?

6 Comments

But that is NOT a sinc function. It looks vaguely like one, but it is not one.
It looks like it’s a sinc function multiplied by some sort of envelope function. Since you have the original data, divide (element-wise) your function by the results of sinc(x) shifted to have the same peak to see if you can determine the envelope function. It would be more convenient if you had the original x-values as well.
Actually, no, it does not look like that. Note that a sinc function has positive and negative lobes that are symmetrical around the X-axis. This function clearly has negative lobes that are all identical in magnitude, so sinc(x)*f(x) does NOT apply here. As well, it is shifted in x, since a sinc is symmetrical around zero.
thanks for your comments.have you seen something like that before? I mean is this a known mathematical figure with a specific name or not?
Perhaps, but not that I know of. Where did you see it? Did that place give a name for it? (I guess not otherwise you wouldn't be asking us.) It sort of looks like a sinc squared (the diffraction pattern of a thin slit, or a sombrero function (the optical diffraction pattern of a small circular aperture). Search sombrero or the cross section of a see this Wikipedia article
I got this figure in the imaginary part of the fourier transform of the white/black square image:
there is white/black border in the 50th column of this 400*400 matrix.
I turned it into the image above because I wanted to see if I can make it similar to a sinc function.

Sign in to comment.

 Accepted Answer

This is about the closest I could get after playing around with it for a few minutes:
x = 1:400;
y = abs(0.055 * sinc((x - 195) / 12)) - 0.001;
% Smooth out a bit
y = conv(y, [1,1,1]/3, 'same');
plot(x, y, 'b-', 'LineWidth', 3);
grid on;
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
Why do you need this, and if you need it, why don't you have the formula for it? Where did you hear of it? Didn't they give you the formula?????

5 Comments

Here's another sort of close one, but it has a singularity at 195:
close all;
clear all;
x = 1:400;
y = 0.055 * (1 + sin((x - 195) / 2));
% Smooth out a bit
y = y .* 0.5./abs(x-195);
plot(x, y, 'b-', 'LineWidth', 3);
grid on;
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
You can play around with the numerical parameters if you want.
thanks. the first one looks very close. I do not care that much about the singularity coordinates and length of the data. I just wanted to know how I can get a shape like this.
I was considering the possibility that it could be a sinc function with both an envelope and an additive offset:
y = sinc(x).*f1(x) + f2(x);
you are right. multiplying the function with an envelope might give the same result. But defining the properties of the envelope (at least for me) wont be easy.
No, not easy if you have to just do trial and error. But if you don't have something known, then how do you know if your formula has gotten it right? And if you do have something knonwn, whether numerical data or a formula, then just use it.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!