On a semilogy plot, how to plot a line connecting two given points A&B and perform linear interpolation
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Matlab_Student
am 10 Okt. 2017
Beantwortet: Walter Roberson
am 10 Okt. 2017
As the question says, I would like to connect two points on a semilogy plot and perform linear interpolation. For example, given two points A(0,1) and B(10,1), draw out the straight line and find y value for x=5.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 10 Okt. 2017
Lx = [A(1),B(1)]; Ly = [A(2), B(2)];
hold on
plot(Lx, Ly, 'c-'); %the connecting line
probe_x = 5;
probed_y = interp1(Lx, Ly, probe_x);
plot(probe_x, probe_y, 'r*');
hold off
This will draw a straight line on the semilogy plot. Which, when you think about it, is likely to be the wrong thing to do, because straight lines in log plots imply constant exponential growth.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Visual Exploration finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!