Matlab Help: Verify Equality of Expressions with Vectors

  • Thread starter Thread starter alexparker17
  • Start date Start date
  • Tags Tags
    Matlab
Click For Summary
SUMMARY

The discussion focuses on verifying the equality of two expressions in MATLAB using symbolic computation. The user attempts to create a vector 'x' ranging from -10 to 10 and computes two expressions, A and B, using logarithmic functions. The user encounters errors related to undefined variables and matrix inversion, specifically with the command 'inv(a)', which fails due to 'a' not being a square matrix. The key takeaway is the importance of ensuring that matrices meet the requirements for operations such as inversion.

PREREQUISITES
  • Familiarity with MATLAB syntax and commands
  • Understanding of symbolic variables in MATLAB
  • Knowledge of matrix operations, particularly inversion
  • Basic understanding of logarithmic functions and their properties
NEXT STEPS
  • Explore MATLAB's symbolic toolbox for advanced mathematical operations
  • Learn about matrix dimensions and conditions for matrix inversion
  • Investigate the properties of logarithmic functions in MATLAB
  • Practice creating and manipulating vectors in MATLAB
USEFUL FOR

Students in mathematics or engineering courses, MATLAB users seeking to understand symbolic computation, and anyone troubleshooting matrix operations in MATLAB.

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

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
Replies
2
Views
2K
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K