Filter löschen
Filter löschen

How can i extrat some value by a plot?

2 Ansichten (letzte 30 Tage)
Pietro Fiondella
Pietro Fiondella am 15 Jul. 2022
Bearbeitet: Voss am 15 Jul. 2022
I have 2 vectors forming a plot
MA=[0.763 0.724 0.822 0.839 0.957 1.000 0.963 0.911 0.583 0.480 0.424 0.490];
Month=[1 2 3 4 5 6 7 8 9 10 11 12];
plot(Month,MonthC_A)
The plot is made be a continuos line that connect 2 succesive value of MA divided of a space 1 (space between of Month elements).
I would like to get a vetor X=[1x48] wich has as elemts, 4 values between each interval of space 1.
For example the first 2 elements of MA are 0.763 and 0.724 and and in the plot are the matching value of 1 and 2 on the x axis, i would like to obtain the value of 1, 1.25, 1.5, 1.75, 2

Akzeptierte Antwort

Voss
Voss am 15 Jul. 2022
Bearbeitet: Voss am 15 Jul. 2022
MonthC_A=[0.763 0.724 0.822 0.839 0.957 1.000 0.963 0.911 0.583 0.480 0.424 0.490];
Month=[1 2 3 4 5 6 7 8 9 10 11 12];
plot(Month,MonthC_A)
Month_interp = linspace(Month(1),Month(end),4*(numel(Month)-1)+1)
Month_interp = 1×45
1.0000 1.2500 1.5000 1.7500 2.0000 2.2500 2.5000 2.7500 3.0000 3.2500 3.5000 3.7500 4.0000 4.2500 4.5000 4.7500 5.0000 5.2500 5.5000 5.7500 6.0000 6.2500 6.5000 6.7500 7.0000 7.2500 7.5000 7.7500 8.0000 8.2500
MonthC_A_interp = interp1(Month,MonthC_A,Month_interp)
MonthC_A_interp = 1×45
0.7630 0.7532 0.7435 0.7337 0.7240 0.7485 0.7730 0.7975 0.8220 0.8262 0.8305 0.8347 0.8390 0.8685 0.8980 0.9275 0.9570 0.9677 0.9785 0.9892 1.0000 0.9908 0.9815 0.9722 0.9630 0.9500 0.9370 0.9240 0.9110 0.8290
hold on
plot(Month_interp,MonthC_A_interp,'r.')

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by