Verifying logarithm expressions with vectors in Matlab

  • Thread starter Thread starter alexparker17
  • Start date Start date
  • Tags Tags
    Matlab
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
alexparker17
Messages
1
Reaction score
0
Matlab Need urgent Help

Homework Statement


Create an appropriate vector 'x' and verify the equality of Right and Left hand sides of the expressions given above.


Homework Equations



Doing this by a/A=1 & b/B=1

The Attempt at a Solution



What i have done so far. But keep on getting this error at the bottom. Any help would be great


>> syms x
>> x=-10:1:10;
>> A=log(x+sqrt(x.^2.+1))

A =

Columns 1 through 13

-2.9982 -2.8934 -2.7765 -2.6441 -2.4918 -2.3124 -2.0947 -1.8184 -1.4436 -0.8814 0 0.8814 1.4436

Columns 14 through 21

1.8184 2.0947 2.3124 2.4918 2.6441 2.7765 2.8934 2.9982

>> B=log(x+sqrt(x.^2.-1))

B =

Columns 1 through 6

-2.9932 + 3.1416i -2.8873 + 3.1416i -2.7687 + 3.1416i -2.6339 + 3.1416i -2.4779 + 3.1416i -2.2924 + 3.1416i

Columns 7 through 12

-2.0634 + 3.1416i -1.7627 + 3.1416i -1.3170 + 3.1416i 0 + 3.1416i 0 + 1.5708i 0

Columns 13 through 18

1.3170 1.7627 2.0634 2.2924 2.4779 2.6339

Columns 19 through 21

2.7687 2.8873 2.9932

>> a;
? Undefined function or variable 'a'.

>> A;
>> a=(exp(x)-exp(-x))/2;
>> b=(exp(x)+exp(-x))/2;
>> inv(a)
? Error using ==> inv
Matrix must be square.
 
Physics news on Phys.org