0

I have these two equations:

y1=a*(10/11- (3*i)/4) + b*(5/6+ (7*i)/5)
y2= -1+(j*2) 

where: y1=y2 , And I want to find the exact value of "a" and "b" using only MATLAB.

Is there any MATLAB command I should use to solve these two equations??

p.s.: I tried to use solve command, but it doesn't give me any answer:

syms a b
y1=a*(10/11- (3*i)/4) + b*(5/6+ (7*i)/5);
y2= -1+(j*2);
s=solve('y1-y2=0',[a b])

It gives me this:

Warning: Explicit solution could not be found. 
> In solve at 160 

s =

[ empty sym ]
James Mitch
  • 519
  • 2
  • 11
  • 26

2 Answers2

1

First, make sure you wrote your equations properly (operation precedence, parentheses):

in y1, the second and third terms are written weird:

if you simplify (according to what you wrote) it just becomes (45/124)*i + b*(67/30)

Also, why mix i and j in y2 ?

If you did all this well, and you still get the same answer, it really means there is no solution possible.

EDIT:

And looking at this again, you don't have a 2 equation / 2 variable system, you have 3 variables (y,a,b)... which means you can't solve.

EDIT 2:

From the last comment: well just do what you say you want to do, equalize the real and imaginary part of both equations:

syms a;
S = solve('a*(10/11)+b*(5/6)=-1','a*(3/4)+b*(7/5)=2');
S = [S.a S.b]

S =

[-4048/855, 226/57]
Smash
  • 3,722
  • 4
  • 34
  • 54
  • Okay, according to MathWorks, both *i* and *j* have the same meaning. So, there is no problem in here. Plus, there should a solution for each one. We have two variables and two equations. I can calculate it by hand if he wants to. Sources: http://www.mathworks.com/help/matlab/ref/i.html http://www.mathworks.com/help/matlab/ref/j.html – James Mitch Feb 19 '13 at 20:03
  • First, no. I have 2 equations with only two variables (a and b). I did not have a "y" inside the two equations. Second, I changes my equations, making them much easier to solve. So no one can make any mistake. Thanks – James Mitch Feb 19 '13 at 20:24
  • I insist that you have 2 equations and 3 variables, or, if you want, 1 equation and 2 variables. Why would `y2` be useful in solving this problem when it does not give any info on `a` or `b` – Smash Feb 19 '13 at 20:30
  • Okay, I see what you are trying to say. Please, notice that `y1` and `y2` are **NOT** the two equations that I wanted to solve. When I tried to solve the problem, I wanted to solve `real(y1)=real(y2)` as the first equation, and `imag(y1)=imag(y2)` as the second equation. After all, y1 and y2 are *complex* equations. I hope you can understand my point, and sorry for the confusion. – James Mitch Feb 19 '13 at 20:39
  • Well then edit your post and show us what was the original equation. – Smash Feb 19 '13 at 20:48
  • These are the original equations. I want the real part of y1 = the real part of y2, and the imaginary part of y1 = the imaginary part of y2. Then, I should get an answer. I want a MATLAB command that do this kind of calculation. – James Mitch Feb 19 '13 at 20:58
-1
>> syms a b
>> solve( a*(10/11- (3*i)/4) + (3/4*i+ ((12)/(31*i))) + b*(5/6+ (7*i)/5i)==-1+(j*2))
a*(- 300/737 + (45*i)/134) - 30/67 + (3045*i)/4154

See official doc.

Mikhail
  • 7,749
  • 11
  • 62
  • 136
  • Umm, for some reason, it didn't work with me. Besides, there should be two answers: one for "a", and the other for "b". The answers must be in numbers. Thank you anyway =) – James Mitch Feb 19 '13 at 19:49
  • -1, what you wrote does not work, even if you correct the missing ' at the beginning and end of the solve – Smash Feb 19 '13 at 19:54
  • @Smash I think it works fine (these are literally the lines from matlab!), and I am giving the correct output for what this guy wrote ( apparently he had a typo). – Mikhail Feb 19 '13 at 20:01