Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Solving values from 5 equations in MATLAB (4 variables)

Status
Not open for further replies.

rayshaumik

Newbie level 1
Joined
Sep 30, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,287
Hi, I have a problem in MATLAB. I am doing research in Optics ... I have to find 4 values from 5 equations and having some trouble. Please help.

I have tried reg this as below: I would be grateful to have any suggestions. Thanks in advance

Code:
clear

T = 0.89;
R = 0.11;
lamda = 0.98;
d = 1.65;
pi = 3.14;
phit = 0.6;
phir = 0.31;
%((-(a))*d) == (23.03)*k;

% sym a b n k; % a and b are "alpha" and "beta"

a = sym('a');
b = sym('b');
n = sym('n');
k = sym('k');

eq1 = T == '({(1-R)^2+4*R*(sin(phir))^2}*exp((-a)*d))/((1-R*exp((-a)*d))^2+4*R*exp((-a)*d)*(sin(b+phir))^2)';
eq2 = (phit) == '((2*(pi)*n*d)/lamda)-(atan((k(n^2+k^2-1))/((k^2+n^2)*(2+n)*n)))+(atan((R*exp((-a)*d))*(sin2(b+phir))/(1-R*exp((-a)*d)*cos2(b+phir))))';
eq3 = (phir) == 'atan(((-2)*k)/(1-((n)^2)-((k)^2)))';
eq4 = (b) == '((2*(pi)*n*d)/lamda)';
eq5 = (a) == '((4*(pi)*k)/lamda)';
%eq6 = (e) == '((-(a))*d) == (23.03)*k';

[a b n k] = solve(eq1,eq2,eq3,eq4,eq5,a,b,n,k);
 
Last edited by a moderator:

You are doing it the hard way imo. 5 equations for 4 variables means 1 of the equations is unnecessary assuming the system is consistent. So you may as well use the Cramer rule for ease of things in your case.
 

First you should research on algebra and systems of equations (linear and nonlinear). It's obvious what you do not know what you are doing.

Not only are more equations than unknowns (generally incompatible), but the relation is direct in some. That would eliminate equations for MATLAB happyness.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top