作业帮 > 综合 > 作业

用matlab求函数表达式

来源:学生作业帮 编辑:拍题作业网作业帮 分类:综合作业 时间:2024/05/01 05:16:52
用matlab求函数表达式
方程组为:sqrt((x4-x3)^2+(y4-y3)^2)=a; (x4-x3)*(x2-x1)+(y4-y3)*(y2-y1)=0
a为定值,y4的表达式.
如果需要,还有以下条件,f已知:
y1=x1^2/(4*f);y2=x2^2/(4*f);x3=(x1+x2)/2;y3=(y1+y2)/2;
clear;clc
syms x1 x2 x4 y4 f a
y1=x1^2/(4*f);
y2=x2^2/(4*f);
x3=(x1+x2)/2;
y3=(y1+y2)/2;
eq1=sqrt((x4-x3)^2+(y4-y3)^2)-a;
eq2=(x4-x3)*(x2-x1)+(y4-y3)*(y2-y1);
D=solve(eq1,eq2,x4,y4);
x4=D.x4
y4=D.y4
再问: Warning: Explicit solution could not be found. > In solve at 98 tangram_guid_1358859679360? Error using ==> subsref No appropriate method, property, or field x4 for class sym. Error in ==> sym.subsref at 17 y = builtin('subsref',x,a);
再答: >> syms x1 x2 x4 y4 f a y1=x1^2/(4*f); y2=x2^2/(4*f); x3=(x1+x2)/2; y3=(y1+y2)/2; eq1=sqrt((x4-x3)^2+(y4-y3)^2)-a; eq2=(x4-x3)*(x2-x1)+(y4-y3)*(y2-y1); D=solve(eq1,eq2,x4,y4); x4=D.x4 y4=D.y4 x4 = 1/32*(x1^3+x2*x1^2+16*f^2*x1-4*x1/(1024*f^2+128*x1*x2+64*x1^2+64*x2^2)*(32*x2*x1^3+32*x1^2*x2^2+16*x2^4+16*x1^4+256*f^2*x1^2+256*f^2*x2^2+32*x2^3*x1+512*(2*x1*x2*a^2*f^4+16*f^6*a^2+x1^2*a^2*f^4+x2^2*a^2*f^4)^(1/2))+x1*x2^2+16*f^2*x2-4*x2/(1024*f^2+128*x1*x2+64*x1^2+64*x2^2)*(32*x2*x1^3+32*x1^2*x2^2+16*x2^4+16*x1^4+256*f^2*x1^2+256*f^2*x2^2+32*x2^3*x1+512*(2*x1*x2*a^2*f^4+16*f^6*a^2+x1^2*a^2*f^4+x2^2*a^2*f^4)^(1/2))+x2^3)/f^2 1/32*(x1^3+x2*x1^2+16*f^2*x1-4*x1/(1024*f^2+128*x1*x2+64*x1^2+64*x2^2)*(32*x2*x1^3+32*x1^2*x2^2+16*x2^4+16*x1^4+256*f^2*x1^2+256*f^2*x2^2+32*x2^3*x1-512*(2*x1*x2*a^2*f^4+16*f^6*a^2+x1^2*a^2*f^4+x2^2*a^2*f^4)^(1/2))+x1*x2^2+16*f^2*x2-4*x2/(1024*f^2+128*x1*x2+64*x1^2+64*x2^2)*(32*x2*x1^3+32*x1^2*x2^2+16*x2^4+16*x1^4+256*f^2*x1^2+256*f^2*x2^2+32*x2^3*x1-512*(2*x1*x2*a^2*f^4+16*f^6*a^2+x1^2*a^2*f^4+x2^2*a^2*f^4)^(1/2))+x2^3)/f^2 y4 = 1/2/(1024*f^2+128*x1*x2+64*x1^2+64*x2^2)*(32*x2*x1^3+32*x1^2*x2^2+16*x2^4+16*x1^4+256*f^2*x1^2+256*f^2*x2^2+32*x2^3*x1+512*(2*x1*x2*a^2*f^4+16*f^6*a^2+x1^2*a^2*f^4+x2^2*a^2*f^4)^(1/2))/f 1/2/(1024*f^2+128*x1*x2+64*x1^2+64*x2^2)*(32*x2*x1^3+32*x1^2*x2^2+16*x2^4+16*x1^4+256*f^2*x1^2+256*f^2*x2^2+32*x2^3*x1-512*(2*x1*x2*a^2*f^4+16*f^6*a^2+x1^2*a^2*f^4+x2^2*a^2*f^4)^(1/2))/f >>