For more examples and details, visit: http://matrixlab-examples.com/scilab-piecewise-function.html
A piecewise function is a function which is defined by multiple sub functions, each sub function applying to a certain interval of the main function's domain.
I’ll show you two ways to define and plot them in Scilab:
1. With iterations, one element at a time.
2. Without iterations, the vectorized way.
To visit an online calculator for this purpose, go to
http://matrixlab-examples.com/calculate-compound-interest.html
I'm gonna show you how to calculate a continuously compounded interest. It has to do with financial math.
Let's solve this problem... we're asked to find the amount of an investment if 40,000 are invested at 6.5% continuously compounded for 5 years.
Then, the principal is 40,000 the annual rate is 6.5 and the time is 5 years.
This is the formula to be used: p is the principal, e is the base of natural logarithms, r is the annual rate, and t is the time in years.
The formula finds out the amount of money that you'll have after those years.
In our case the principal is 40 thousand, the nominal rate per year is 6.5% and the time is 5 years
Let's use the calculator that we have prepared for that purpose:
http://matrixlab-examples.com/calculate-compound-interest.html
We just fill in the blanks with our data...
we enter the principal, now we enter the interest rate per year, now the time in years...
We can modify the numbers just to study other scenarios or cases...
and we get the final amount with continuously compounded interest
Thank you for watching!
For more examples and details, visit: http://matrixlab-examples.com/factorials.html
In mathematics, the factorial of a positive integer n, denoted by n!, is the product of all positive integers less than or equal to n.
By definition, the factorial of 0 (noted 0!) is 1.
The shown code is a way of handling it in Matlab.
More info: https://matrixlab-examples.com/3D-plot-2tier.html
https://matrixlab-examples.com
How to create 3D Plots in Matlab
3 Easy steps:
1.- Define your intervals and steps within.
2.- Define your grid using the built-in function 'meshgrid'.
3.- Use an appropriate 3D function to plot what you need: surf, surfc, plot3, mesh, contour3, etc.