Asked by Pavel
on 4 Apr 2014

I have the folowing code. My 3 equations are diff_f1, diff_f2 and diff_f3 with the unkowns a,b,c. I need to make the equations equal to 0 and to solve for a,b and c, but when i do that i obtain that a=b=c=0 and that are not the answers i'm looking for. What i'm doing wrong and how i can solve these equations?

if true clear all clc % a=alpha1; b=alpha2; c=betha syms a b c d N1 N2 N3 N21 N31 n2 n21 n3 l1 l2 l3 P L sa % Se calculeaza lungimea elementelor P=2000; L=1300; sa=150; l1=L/cos(a); l2=L/cos(b); l3=L/cos(b+c); d=a+b; % Se calculeaza A N21=(-P*cos(b+c)/(cos(b)*sin(b+c)-cos(b+c))); N31=P/(sin(b+c)-cos(b+c)/cos(b)); n31=(-sin(a)*cos(b)-sin(b)*cos(a))/(sin(b+c)*cos(b)-cos(b+c)*sin(b)); n3=n31; n21=(cos(a)-n3*cos(b+c))/cos(b); n2=n21; %efortul din elementul 1 N1=(-((n2*l2*N21+n3*l3*N31)/(l1+n2^2*l2*n3^2*l3))); %efortul din elementul 3 N3=(P*cos(b)-N1*sin(a)*cos(b)-N1*cos(a))/(cos(b)*(sin(b+c)-cos(b+c))); %efortul din elementul 2 N2=(N1*cos(a)-cos(b+c)*N3)/(cos(b)); %definrea functiei obiectiv V1=((N1/sa)*l1+(N2/sa)*l2+(N3/sa)*l3); %diff(V(a,b,c),a) V=simplify(V1); diff_f1=diff(V,a); diff_f2=diff(V,b);

diff_f3=diff(V,c);

[a b c]=solve('diff_f1=0','diff_f2=0','diff_f3=0');

end

*No products are associated with this question.*

Answer by Walter Roberson
on 4 Apr 2014

Accepted answer

[a, b, c] = solve(diff_f1, diff_f2, diff_f3);

Show 2 older comments

Pavel
on 5 Apr 2014

Thank you. I used this code:

if true S=vpasolve([diff_f1==0, diff_f2==0, diff_f3==0], [a b c],[-2*pi 2*pi]) end but i get the following error: "Undefined function 'vpasolve' for input arguments of type 'sym'. "

Walter Roberson
on 5 Apr 2014

Which MATLAB release are you using?

In the meantime try

feval(symengine, 'numeric::solve', [diff_f1, diff_f2, diff_f3], [a b c], [-2*pi 2*pi])

Pavel
on 5 Apr 2014

i'm using R2012a

Log in to comment.

Related Content

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
## 0 Comments

Log in to comment.