Slider

***** Go UP! *****. ***** *****

MATLAB GUIDE

SIMULINK


ELECTRICITY COST CALCULATOR WITH MATLAB

This calculator will help you estimate
 the cost of operating any given electrical device or appliance at home, based on the average kilowatt-hours (KWH) used, and on the rate (per kilowatt-hour) charged by the company that supplies you with electricity.


You need to enter the estimated power consumed by the device (in watts), the time of use (in hours) and the electricity rate (in dollars, or in your own currency, per KWH).
The calculation is based on this formula:

ec=(WH / 1000) *R
Where:
ec
 = electricity charges
W
 = power of device (in watts)
H
 = time (in hours)
R
 = electricity rate (in dollars per KWH)
The power of the device is usually mentioned somewhere on your device. Often, it has a label showing the watts (power) it consumes when in use.
Sometimes, the power is not mentioned, but the voltage (in volts, V) and current (in amperes, A) are mentioned. Power equals volts multiplied by amperes (W = VA).
 
We then create an easy Matlab function to calcúlate the formula above: 
This is the coding done in “EMBEDDED FCN” Block
function ec = electric_cost_calc(w, h, r)
ec = w * h/1000 * r;
 


MATLAB- SIMULINK MODE



 Example 1: 

You’ve been using 6 60W ligth bulbs for 3 hours. Your electricity rate is 13.1 cents per KWH. What’s the charge for this consumption of electricity? 
We launch our handy electricity-cost-calculator and enter try_ec (or the name we saved for our driver) on our command window. 
Enter power of your device (in watts): 6 * 60
Enter time (in hours): 3
Enter electricity rate (in dollars per KWH): 0.131 
The result is: 
ec = 0.14
(that is 14 cents)

Example 2: 


You’re experimenting with scientific devices at home. Your great invention consumes 1200 W during 30 minutes. The assumed electricity charges from your company are 16.3 cents per KWH. How much does testing your invention cost you?
 
We launch again our calculator and get:
 
Enter power of your device (in watts): 1200
Enter time (in hours): .5
Enter electricity rate (in dollars per KWH): .163 
The result is: 
ec = 0.10 (that is 10 cents)

Future Value - how to calculate it using Matlab
This program is an example of a financial application in Matlab. It calculates the future valueof an investment when interest is a factor. 

It is necessary to provide the amount of the initial investment, the
 nominal interest rate, the number of compounding periods per year and the number of years of the investment.

where: 
t = total value after y years (future value)
y = number of years
p = initial investment
i = nominal interest rate
n = number of compounding periods per year 
We can achieve this task very easily with Matlab. First, we create a function to request the user to enter the data. Then, we perform the mathematical operations and deliver the result.



This is the function that requests the user to enter the necessary information: 
This is the function that performs the operations: 
function t = future_value(ii, nir, ncppy, ny)
% Convert from percent to decimal
ni = nir / (100 * ncppy);
% Calculate future value by formula
t = ii*(1 + ni)^(ncppy * ny);
% Round off to nearest cent
t = floor(t * 100 + 0.5)/100;

MATLAB- SIMULINK MODE





Simulink, developed by Math Works, is a data flow graphical programming language tool for modeling, simulating and analyzing multi domain dynamic systems. Its primary interface is a graphical block diagramming tool and a customization set of block libraries. It offers tight integration with the rest of the MATLAB environment and can either drive MATLAB or be scripted from it. Simulink is widely used in control theory and digital signal processing for multi domain simulation and Model-Based Design.

Simulink® is a block diagram environment for multi domain simulation and Model-Based Design. It supports system-level design, simulation, automatic code generation, and continuous test and verification of embedded systems.

Simulink provides a graphical editor, customization block libraries, and solvers for modeling and simulating dynamic systems. It is integrated with MATLAB®, enabling you to incorporate MATLAB algorithms into models and export simulation results to MATLAB for further analysis

.

FEEDBACK

Contact Form

Name

Email *

Message *