How do I find the zero crossings for a function sinx/x against x?
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
ANKUR KUMAR
el 11 de Jul. de 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 contains the x values which corresponds to zero in y values.
0 comentarios
Matt J
el 11 de Jul. de 2021
Editada: Matt J
el 11 de Jul. de 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 comentarios
Ver también
Categorías
Más información sobre Function Creation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!