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

# Thread Subject: solve: multiple equations with multiple parameters and plot

 Subject: solve: multiple equations with multiple parameters and plot Date: 16 Mar, 2012 13:24:16 Message: 1 of 4 i am new, trying to figure out MATLAB and is unable to solve this problem. I have d following given 8 equations and from them need to find a relation between r and nf and hence plot with nf as x-axis and r as y-axis. The problem is whatever I am trying I always get r as empty set and matlab displays the warning 'Explicit solution could not be found'. what am i doing wrong? thanks for all the help in advance clear; clc; syms k sigc L neff lm lmD Sneff N sigc nf r; eq1='k=2/L'; eq8='k=pi*Sneff/lm'; eq2='N=10000'; eq3='lmD=2*neff*N/L'; eq4='sigc=(2*pi*neff*((1/lm)-(1/lmD)))+(2*pi*Sneff/lm)'; eq5='nf=lm/((1+(Sneff/neff))*lmD)'; eq6='nf=1/(1+((sigc*L)/(pi*N)))'; eq7='r=((sinh(sqrt(k^2-sigc^2)*L))^2)/(((cosh(sqrt(k^2-sigc^2)*L))^2)-((sigc^2)/k^2))'; r=solve(eq1,eq2,eq3,eq4,eq5,eq6,eq7,eq8,nf); nf=[.999:.0001:1.0005]; plot(nf,r);
 Subject: solve: multiple equations with multiple parameters and plot From: Roger Stafford Date: 17 Mar, 2012 01:55:12 Message: 2 of 4 "Gagandeep Singh Khurana" wrote in message ... > ..... I have d following given 8 equations and from them need to find a relation between r and nf and hence plot with nf as x-axis and r as y-axis. The problem is whatever I am trying I always get r as empty set and matlab displays the warning 'Explicit solution could not be found'. > what am i doing wrong? ....... > syms k sigc L neff lm lmD Sneff N sigc nf r; - - - - - - - -   You have one too few equations. From these eight you cannot obtain r as a function of nf alone. To give a simple example consider the three equations:  y = x+a+b  3*x-a+5*b = 7  4*x+2*a-3*b = 4 From these you can eliminate a and b and obtain one equation in x and y alone without a and b. That would allow you to plot y as a function of x. Each equation eliminates one variable. In your case you have eight equations and ten variables. Seven of the equations can be used to eliminate seven variables but that still leaves you with one equation and three variables, not two. Do you wonder that 'solve' gave up? Roger Stafford
 Subject: solve: multiple equations with multiple parameters and plot Date: 19 Mar, 2012 12:52:11 Message: 3 of 4 "Roger Stafford" wrote in message ... > "Gagandeep Singh Khurana" wrote in message ... > > ..... I have d following given 8 equations and from them need to find a relation between r and nf and hence plot with nf as x-axis and r as y-axis. The problem is whatever I am trying I always get r as empty set and matlab displays the warning 'Explicit solution could not be found'. > > what am i doing wrong? > ....... > > syms k sigc L neff lm lmD Sneff N sigc nf r; > - - - - - - - - > You have one too few equations. From these eight you cannot obtain r as a function of nf alone. To give a simple example consider the three equations: > > y = x+a+b > 3*x-a+5*b = 7 > 4*x+2*a-3*b = 4 > > From these you can eliminate a and b and obtain one equation in x and y alone without a and b. That would allow you to plot y as a function of x. Each equation eliminates one variable. In your case you have eight equations and ten variables. Seven of the equations can be used to eliminate seven variables but that still leaves you with one equation and three variables, not two. Do you wonder that 'solve' gave up? > > Roger Stafford thank you for help Roger. i'm able to reduce my equations to now 2 equations with three variables. can you please guide me how get the required equation between any two variables. thanks in advance
 Subject: solve: multiple equations with multiple parameters and plot From: Roger Stafford Date: 19 Mar, 2012 16:13:12 Message: 4 of 4 "Gagandeep Singh Khurana" wrote in message ... > i'm able to reduce my equations to now 2 equations with three variables. can you please guide me how get the required equation between any two variables. - - - - - - - - - -   we can't help you unless you show us those equations. Roger Stafford