how to plot shorter dataset using 'hold on'

Hi,
I have a dataset and want to plot a line of best fit to the beginning of the data which is the only part where it fits.
Currently, I have the lines of code:
scatter(T5half,logconductivity5(2:end))
hold on
y=-21.05*T5half-25.18
plot(T5half,y)
Does anyone know how to do this?
Thanks.

 採用された回答

Jeff Miller
Jeff Miller 2022 年 2 月 26 日

0 投票

Is this what you need?
desired_range = 1:200; % here, select the array positions you want to plot
plot(T5half(desired_range),y(desired_range))

その他の回答 (0 件)

カテゴリ

製品

リリース

R2021b

質問済み:

Em
2022 年 2 月 26 日

コメント済み:

Em
2022 年 2 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by