Find X value corresponding to Y value in a equation and find doesn't help as the y vector doesn't contain the exact value.
Afficher commentaires plus anciens
Hi everybody,
I am noob, so please help me out.
I am trying to find the beamwidth of a rectangular patch antenna. I have plotted the equations, but i have to find the value of x corresponding to the value at y=0.5. The function 'find' doesn't help as there is no exact value of y at 0.5. The result is a 1-by-0 empty matrix, which i guess is a null.
interp1 also doesn't help as I dont know the x-value.
So can you help me out?
Réponses (2)
You should be interpolating with y as the domain and x as the range
xi =interp1(y,x,0.5)
1 commentaire
Rachel Kufakunesu
le 8 Juin 2017
Thank you Matt J. After searching high and low, your answer solved my problem!
Sample function
x = 0:0.1:1;
y = x.^2;
Find approximative solution for y = 0.5
a = abs(y - 0.5);
ind = find(a == min(a));
Find exact solution with the approximative solution as starting value
fzero(@(x)(x^2 - 0.5), x(ind))
Catégories
En savoir plus sur Full-Wave Analysis dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!