Interpolating on a semilog scale

51 visualizaciones (últimos 30 días)
Jenna Scott
Jenna Scott el 30 de En. de 2020
Comentada: Ander de Marcos Arocena el 18 de Nov. de 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?

Respuesta aceptada

Star Strider
Star Strider el 30 de En. de 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 comentarios
Görkem ÜLKÜTAS
Görkem ÜLKÜTAS el 27 de Mayo de 2020
Editada: Görkem ÜLKÜTAS el 27 de Mayo de 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
Ander de Marcos Arocena el 18 de Nov. de 2021
Did you find the solution to your problem? I want to do the same

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Interpolation 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!

Translated by