Mail Adress

Have you a registration already ? Sign In

Please enter a valid email address.

Please confirm the membership and confidentiality agreement.

Obtaining Full Polynomial From Its Coefficients In MatLab®

- Home Page
- All Programs
- Value Calculation With ‘subs()’ Command In MatLab®

Here, we explain a very useful command available in Matlab®. This command is named ‘subs()’ If you have a very complex equation, and you need to calculate a specific value of this equation according to a value of the variable of this equation; you can use the ‘subs()’ command.

Here, we explain how to use the ‘subs()’ command in Matlab® with a very basic example that is executed in the command window. Check it out.

```
>> syms a
y = a-3 + (3/(a-1)) - (2/(a+9));
z = subs(y,a,a^2+3)
d = subs(z, a, 2)
z =
3/(a^2 + 2) - 2/(a^2 + 12) + a^2
d =
35/8
>>
```

As you see in the example above, we created a symbolic variable ‘a’ with ‘syms’ command. And, we defined our ‘complex’ equation with this variable which is assigned to ‘y’.

Consider a situation that we want to see the new value of function ‘y’ with the new value of ‘a’ equals ‘a^2+3’. So, we used the ‘subs()’ command to do it.

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

We defined the ‘subs()’ command by typing three elements inside it. The first element is the name of the function which is ‘y’ in the example above. The second one is the variable of this function, which is ‘a’ in the example above. Then the third one is as you guessed, the new value ”a^2+3′. You can see the first answer ‘z’.

We can use this ‘z’ function to calculate its value for ‘a=3’. So, we defined another ‘subs()’ for it. You can see the second answer ‘d’ for this new value.

As you see that, the ‘subs()’ command is a very easy-to-use and very useful command in Matlab® that you can calculate various kinds of calculations.

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

If you want further coding examples about the ‘subs()’ 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.

Similar Posts

- Site Comments

Popular Posts

Write Comments