How to combine two trendlines from two different plot?

1 次查看(过去 30 天)
I have array data. Let's say time, x, and y. They are all 117*1 array. Then i make plots. And then i add a trendline for each plot using polyfit.
aa=polyfit(time,x,1);
bb=polyval(aa,time);
figure
plot(time,x)
hold on
plot(time,bb)
cc=polyfit(time,y,1);
dd=polyval(cc,time);
figure
plot(time,y)
hold on
plot(time,dd)
So then i have 2 figures with 2 trendlines. I have a trouble about how to combine these two trendline in one figure. So that i can calculate the angle between the trendlines. Thank you..

采纳的回答

Birdman
Birdman 2018-2-6
编辑:Birdman 2018-2-6
One figure definition is enough.
aa=polyfit(time,x,1);
bb=polyval(aa,time);
figure
plot(time,x)
hold on
plot(time,bb)
cc=polyfit(time,y,1);
dd=polyval(cc,time);
plot(time,y)
plot(time,dd)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by