Home » All Programs » Expansion Of Equations In MatLab® With ‘expand()’ Command

Expansion Of Equations In MatLab® With ‘expand()’ Command

Sometimes, hand calculations for mathematical operations can be a very tough business. If you know how to do them in MatLab®, these jobs can be very easy.

Here, we explain how to expand equations into more understandable situations in Matlab® by using the ‘expand()’ command. To understand syntax and use of the ‘expand()’ command, check the examples below that are executed in the Matlab® command window.

How To Use ‘expand()’ Command In Matlab®? 

>> syms a
x = a+1; y=a-3;
z=x*y;
expand(z)
 
ans =
 
a^2 - 2*a - 3
 
>> 

You can see the usefulness of the ‘expand()’ command in the example above. First of all, we created a symbolic variable ‘a’ which will be used as variable in expansion operations. 

And we created two separate basic equations with ‘a’. We multiplied them then assigned them to another variable ‘z’. But, we want to see the expanded form of this multiplication. 

To do it, we typed the ‘z’ inside the ‘expand()’ command and you can see the expanded answer above. 

>> syms a b
x = cos(a+b);
expand(x)
 
ans =
 
cos(a)*cos(b) - sin(a)*sin(b)
 
>> 

expand() command is also very useful for the expansion of trigonometric expressions. Take a look at the example above to understand it.

Conclusion

The use of the ‘expand()’ command to make mathematical expansions in Matlab® is very simple as you see above. 

Do not forget to leave your comments and questions below about the use of the expanding () command in Matlab® below. 

YOU CAN LEARN MatLab® IN MECHANICAL BASE; Click And Start To Learn MatLab®!

If you want further coding examples about the expand() command in Matlab®, inform us in the comments.

This article is prepared for completely educative and informative purposes.

Your precious feedbacks are very important to us.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *


Please

leave feedback ?

( For the post )

ASK THE MECHANICALLAND

COMMUNITY


We are always open to your feedback to improve ourselves and the quality of our content! If you have any suggestions, thoughts, or criticism, please let us know. We are trying to improve our blog with constructive feedback. We are aware of how valuable your feedback is for our future development, and we will carefully read all your comments. Thank you in advance!