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

4 visualizzazioni (ultimi 30 giorni)
Salreem il 11 Lug 2021
Modificato: Matt J il 11 Lug 2021
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')
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (2)

ANKUR KUMAR il 11 Lug 2021
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 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Matt J il 11 Lug 2021
Modificato: Matt J il 11 Lug 2021
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.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Operating on Diagonal Matrices in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by