y1 = -a1*x1 + c1
有两行theta =30
,y1 = -a2*x1 + c2
有两行theta = 45
是否有可能在matlab中为y1
插入30到45之间theta
的等式?这些线几乎彼此平行。任何人都有这么简单的方法吗?
答案 0 :(得分:2)
您可以插入系数a
和c
:
w = (theta - 30) / (45 - 30 ); % w = 0 for theta = 30 and w = 1 for theta = 45
aTheta = a2 * w + a1 * ( 1 - w );
cTheat = c2 * w + c1 * ( 1 - w );
yTheta = -aTheta * x + cTheta * y;
答案 1 :(得分:0)
x = 1:10;
a30 = 1;
a45 = 1.1;
c30 = 0;
c45 = 3;
y30 = -a1*x + c1;
y45 = -a2*x + c2;
现在找到y40
我们可以插入曲线参数(即斜率(a
)和偏移量(c
))
a40 = interp1([30,45], [a30, a45], 40);
c40 = interp1([30,45], [c30, c45], 40);
现在我们的插值y40
是
y40 = -a40*x + c40;
plot(x,y30,x,y45,x,y40);