如何用Matlab画隐函数(带参数)的方程
来源:学生作业帮 编辑:作业帮 分类:数学作业 时间:2024/11/06 02:29:46
如何用Matlab画隐函数(带参数)的方程
三个变量:x x0 y,
两个约束方程:
2*(sin(x))^2*cos(x)-cos(x)+cos(x0)-sin(x0)=0
y=(sin(x)-cos(x)-sin(x0)+cos(x0))*(1+ctan(x0))
要画x0与y之间的曲线关系图.
三个变量:x x0 y,
两个约束方程:
2*(sin(x))^2*cos(x)-cos(x)+cos(x0)-sin(x0)=0
y=(sin(x)-cos(x)-sin(x0)+cos(x0))*(1+ctan(x0))
要画x0与y之间的曲线关系图.
没有什么太好的办法.
【1】解第一个方程,用1-(cos(x))^2=(sin(x))^2
>> x=solve('2*(1-(cos(x))^2)*cos(x)-cos(x)+cos(x0)-sin(x0)=0','x')
x =
[ acos(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3))]
[ acos(-1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)))]
[ acos(-1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)))]
【2】变换ctan为1/tan
>>y='(sin(x)-cos(x)-sin(x0)+cos(x0))*(1+1/tan(x0))'
【3】替换y中的x,为x0的变量
>> y1=subs(y,'x',x)
y1 =
[ ((1-(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3))^2)^(1/2)-1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-sin(x0)+cos(x0))*(1+1/tan(x0))]
[ ((1-(-1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)))^2)^(1/2)+1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3))-sin(x0)+cos(x0))*(1+1/tan(x0))]
[ ((1-(-1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)))^2)^(1/2)+1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3))-sin(x0)+cos(x0))*(1+1/tan(x0))]
【4】用ezplot分别画图
>> ezplot(y1(1))
>> ezplot(y1(2))
>> ezplot(y1(3))
【1】解第一个方程,用1-(cos(x))^2=(sin(x))^2
>> x=solve('2*(1-(cos(x))^2)*cos(x)-cos(x)+cos(x0)-sin(x0)=0','x')
x =
[ acos(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3))]
[ acos(-1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)))]
[ acos(-1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)))]
【2】变换ctan为1/tan
>>y='(sin(x)-cos(x)-sin(x0)+cos(x0))*(1+1/tan(x0))'
【3】替换y中的x,为x0的变量
>> y1=subs(y,'x',x)
y1 =
[ ((1-(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3))^2)^(1/2)-1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-sin(x0)+cos(x0))*(1+1/tan(x0))]
[ ((1-(-1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)))^2)^(1/2)+1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3))-sin(x0)+cos(x0))*(1+1/tan(x0))]
[ ((1-(-1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)))^2)^(1/2)+1/12*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)+1/2*i*3^(1/2)*(1/6*(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3)-1/(54*cos(x0)-54*sin(x0)+6*(-6+81*cos(x0)^2-162*cos(x0)*sin(x0)+81*sin(x0)^2)^(1/2))^(1/3))-sin(x0)+cos(x0))*(1+1/tan(x0))]
【4】用ezplot分别画图
>> ezplot(y1(1))
>> ezplot(y1(2))
>> ezplot(y1(3))