
Math Software Math Software  Mathematica, Matlab, Calculators, Graphing Software 
 LinkBack  Thread Tools  Display Modes 
May 9th, 2017, 05:25 AM  #1 
Newbie Joined: Nov 2016 From: Aus Posts: 14 Thanks: 0  Solving equation in Matlab
Hi All I'm newbie and do not have that experience in Matlab but really in urgent help with this question? Could you please help with solving this equation for X in Matlab? S*e=(C.^2)/E*X^b+f*C*(X)^(b+a) S,e, E are constants C,f,b, and a are known row vectors of 12 elements, so expect 12 value for X S=328, e=0.0033, E=204000 this code comes with errors C= [777.5 777.5 798.75 820 832.75 832.75 841.25 862.5 883.75 905 926.25 947.] f=[0.630796209 0.652441176 0.642583333 0.632803922 0.626973922 0.626973922 0.623102941 0.613480392 0.603936275 0.594470588 0.585083333 0.57577451] b=[0.09 0.09 0.09 0.09 0.09 0.156 0.09 0.09 0.09 0.09 0.09 0.09 ] a=[0.56 0.56 0.56 0.56 0.56 0.485 0.56 0.56 0.56 0.56 0.56 0.56 ] b=[0.09 0.09 0.09 0.09 0.09 0.156 0.09 0.09 0.09 0.09 0.09 0.09 ]; c=[0.56 0.56 0.56 0.56 0.56 0.485 0.56 0.56 0.56 0.56 0.56 0.56 ]; N=[1 12]; SF=[777.5 777.5 798.75 820 832.75 832.75 841.25 862.5 883.75 905 926.25 947.5 ]; ef=[0.630796209 0.652441176 0.642583333 0.632803922 0.626973922 0.626973922 0.623102941 0.613480392 0.603936275 0.594470588 0.585083333 0.57577451 ]; E=204000; SMx=328.4; de2=0.033; for k=1:12 eqn=(de2*SMx((SF(k))^2/E)*((2*N(k))^b(k))ef(k)*SF(k)*((2*N(k))^((b(k)+c(k))))== 0); vpasolve(eqn,N(k)) end; Thank you so much Last edited by Naz Ar; May 9th, 2017 at 06:11 AM. 
May 9th, 2017, 06:27 AM  #2 
Senior Member Joined: Feb 2016 From: Australia Posts: 1,734 Thanks: 605 Math Focus: Yet to find out. 
Could you please write out what you are trying to do exactly, and what errors you are getting. This is a mess.

May 9th, 2017, 06:58 AM  #3  
Newbie Joined: Nov 2016 From: Aus Posts: 14 Thanks: 0  Quote:
I want to solve the equation in terms of different inputs and get the N value for each input I do not how to define the vector of the output, and how to recall the output from the loop The error is ((Index exceeds matrix dimensions. Error in sym/subsref (line 776) R_tilde = builtin('subsref',L_tilde,Idx); Error in equ_tion (line 14) eqn=(de2*SMx((SF(k))^2/E)*((2*N(k))^b(k))ef(k)*SF(k)*((2*N(k))^((b(k)+c(k))))== 0); ))) the code is (( b=[0.09 0.09 0.09 0.09 0.09 0.156 0.09 0.09 0.09 0.09 0.09 0.09 ]; c=[0.56 0.56 0.56 0.56 0.56 0.485 0.56 0.56 0.56 0.56 0.56 0.56 ]; syms N ; SF=[777.5 777.5 798.75 820 832.75 832.75 841.25 862.5 883.75 905 926.25 947.5 ]; ef=[0.630796209 0.652441176 0.642583333 0.632803922 0.626973922 0.626973922 0.623102941 0.613480392 0.603936275 0.594470588 0.585083333 0.57577451 ]; E=204000; SMx=328.4; de2=0.033; for k=1:12 eqn=(de2*SMx((SF(k))^2/E)*((2*N(k))^b(k))ef(k)*SF(k)*((2*N(k))^((b(k)+c(k))))== 0); vpasolve(eqn,N(k)) end; )))  
May 9th, 2017, 07:17 AM  #4 
Math Team Joined: Oct 2011 From: Ottawa Ontario, Canada Posts: 13,461 Thanks: 949  As Joppy says: what a mess! Is that same as: S*e = [C^2 / E] * [X^b] + [f*C*X^(b+a)] ? Simplify it a bit: u = S*e, v = f*C, w = b+a to get: u = [C^2 / E] * [X^b] + [v*X^w] Anyhow, with X^b and X^(b+a), can't be solved directly... Agree Sir Joppy? 
May 13th, 2017, 08:47 PM  #5 
Newbie Joined: Nov 2016 From: Aus Posts: 14 Thanks: 0 
Please help with this problem. I tried to make it clearer '' syms N b, c, e, and s =row vectors of ten elements A=6; (scalar value) B=e*s; M=b+c; eqn=(A(s^2)*((2*N)^b)B*((2*N)^(M))== 0); for k=1:10 vpasolve(eqn,N(k)); end; '' how to solve N for all the vector elements (inputs) This loop does not work as error come as follows Error using ^ Inputs must be a scalar and a square matrix. To compute elementwise POWER, use POWER (.^) instead. (tried but did not work) Error in equ_tion (line 16) eqn=(A(SF^2)*((2*N)^b)B*((2*N)^(M))== 0); (cannot figure out what is the wrong here) Thanks 
May 13th, 2017, 09:41 PM  #6  
Senior Member Joined: Feb 2016 From: Australia Posts: 1,734 Thanks: 605 Math Focus: Yet to find out.  Quote:
Code: syms N b = randn(10,1)'; c = randn(10,1)'; e = randn(10,1)'; s = randn(10,1)'; A = 6; %(scalar value) B = e.*s; M = b + c; f1 = A (s.^2).*((2.*N).^b) f2 = B.*((2.*N).^(M)) eqn=((f1  f2) == 0);  
May 15th, 2017, 09:16 PM  #7 
Newbie Joined: Nov 2016 From: Aus Posts: 14 Thanks: 0 
Thank you Joppy for your response and suggestion When applied your code it does not solve the equation. do you advise any function to solve this eqn please Regards 

Tags 
equation, matlab, solving 
Thread Tools  
Display Modes  

Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Solving a system of differential equations (Implicit Analysis) Matlab  M94Antony  Calculus  0  August 27th, 2016 02:52 PM 
Solving Nonlinear System using Matlab  xsw001  Differential Equations  1  August 30th, 2014 05:16 PM 
Solving an equation  Amaz1ng  Algebra  8  April 23rd, 2011 06:15 PM 
Nonlinear equation system in Matlab  Orient Blue  Applied Math  6  May 9th, 2010 09:15 AM 
solving an equation  jhon13  Complex Analysis  0  December 31st, 1969 04:00 PM 