0

我有两行y1 = -a1*x1 + c1fortheta =30y1 = -a2*x1 + c2fortheta = 45 是否可以在 matlab 中y1theta30 到 45 之间插入一个方程?这些线几乎彼此平行。任何人都有一个简单的方法来做到这一点?

4

2 回答 2

2

您可以插值 coeffac

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;
于 2013-10-24T11:06:42.320 回答
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);
于 2013-10-24T11:12:42.550 回答