# How do I find the zero crossings for a function sinx/x against x?

조회 수: 9 (최근 30일)
Salreem 2021년 7월 11일
편집: Matt J 2021년 7월 11일
I have used the following code to plot
x=linspace(-90,90,10000);
y=sin(x)./x;
plot(x,y);
axis([-90 90 -1.5 1.5])
xlabel('x')
ylabel('y')
title('A GRAPH OF A FUNCTION Y=(SINX)/X AGAINST X')

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

### 답변 (2개)

ANKUR KUMAR 2021년 7월 11일
Do you mean to find the x values which cooresponds to the zero in the y values?
I do not think you have zero value in y variables (It is close to zero, but not exactly zero).
This is an example using the round function so that it yields nearest integer value.
x=linspace(-90,90,10000);
y=round(sin(x)./x);
x_vals=x(y==0)
x_vals = 1×9790
-90.0000 -89.9820 -89.9640 -89.9460 -89.9280 -89.9100 -89.8920 -89.8740 -89.8560 -89.8380 -89.8200 -89.8020 -89.7840 -89.7660 -89.7480 -89.7300 -89.7120 -89.6940 -89.6760 -89.6580 -89.6400 -89.6220 -89.6040 -89.5860 -89.5680 -89.5500 -89.5320 -89.5140 -89.4959 -89.4779
x_vals contains the x values which corresponds to zero in y values.
##### 댓글 수: 0이전 댓글 -2개 표시이전 댓글 -2개 숨기기

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

Matt J 2021년 7월 11일
편집: Matt J 2021년 7월 11일
You can see analytically that the zeros will occur when the numerator sin(x) has a zero crossing, which will occur at non-zero integer multiples of pi. At x=0, L'hopital's rule readily shows you that there is no zero crossing there.

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

### 카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by