怎么在matlab里面求已有两条曲线的交点?

来源:百度知道 编辑:UC知道 时间:2024/05/20 19:10:39
两条曲线方程已知,matlab能自动求其多个交点的横纵坐标吗?
谢谢!

zR = solve('1/(0.00379-0.000283*log10(0.101325+1030*9.81*(750+z)*0.000001))-273.15-(2.2+0.054*z+2*erfc(z/2*sqrt(3E-7*500)))','z');
tR = 1/(0.00379-0.000283*log10(0.101325+1030*9.81*(750+zR)*0.000001))-273.15;
zSol = double(zR);
tSol = double(tR);
str = sprintf('The intersection of 2 lines is : \n z = %f \n t = %f', zSol,tSol);
disp(str);
plot(tSol,zSol,'r+','LineWidth',3,'MarkerSize',13);

很简单得啦,例如:
>> [x,y]=solve('y=x^2','y=x+1')

x =

-1/2*5^(1/2)+1/2
1/2+1/2*5^(1/2)

y =

-1/2*5^(1/2)+3/2
3/2+1/2*5^(1/2)

可以验证:
>> x=-2:0.1:2
>> y1=x.^2
>> y2=x+1
>> plot(x,y1,x,y2)