Interpolating on a semilog scale
49 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jenna Scott
le 30 Jan 2020
Commenté : Ander de Marcos Arocena
le 18 Nov 2021
I have a set of data, A = [25 20 10 5 2 0.5 0.07] and B = [100 90 80 72 67 56 44]. I've graphed it with A on the semilogx axis and B on the linear y axis. I would like to find the ordered pair (x1, 50), where I know the y-value but not the x-value, but using interp1 has just resulted in linear interpolation that doesn't seem to take into account the semilog scale. How can I find x1?
0 commentaires
Réponse acceptée
Star Strider
le 30 Jan 2020
The interp1 function needs to know about the log transformation. Then, it will give you the correct result.
Try this:
A = [25 20 10 5 2 0.5 0.07];
B = [100 90 80 72 67 56 44];
y1 = 50;
x1 = exp(interp1(B, log(A), y1));
figure
semilogx(A, B)
hold on
plot(x1, y1, 'p')
hold off
grid
The plot is just to demonstrate the result graphically.
4 commentaires
Görkem ÜLKÜTAS
le 27 Mai 2020
Modifié(e) : Görkem ÜLKÜTAS
le 27 Mai 2020
Hello Star Strider,
Actually, I have the reverse version of this problem but I couldn't modified your answer correctly. In my case,
x = [0.6, 0.8, 1, 1.5, 2, 3, 4, 6, 8]; (log scale)
y = [0.0087, 0.0070, 0.0060, 0.0047, 0.0043, 0.0041, 0.0038, 0.0035, 0.0034]; (linear scale)
I want to interpolate for example x = 1.25 to get corresponding y value. Can you help me please.
Thank you!
Ander de Marcos Arocena
le 18 Nov 2021
Did you find the solution to your problem? I want to do the same
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Interpolation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!