在两个已知函数matlab之间插值数据

时间:2013-10-24 10:55:03

标签: matlab matlab-figure

y1 = -a1*x1 + c1有两行theta =30y1 = -a2*x1 + c2有两行theta = 45 是否有可能在matlab中为y1插入30到45之间theta的等式?这些线几乎彼此平行。任何人都有这么简单的方法吗?

2 个答案:

答案 0 :(得分:2)

您可以插入系数ac

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);
相关问题