gui program

Upload: aminu-bugaje

Post on 07-Apr-2018

212 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 Gui Program

    1/12

    ANALYZING MAXIMUM POWER TRANSFER TO A LOAD RESISTANCE USING

    MATLAB, SIMULINK, AND GUI.

    Objective:

    1. To calculate and plot maximum power against load resistance, using M-file.2. Use of GUI and Simulink to plot maximum power against load resistance.3. Analyzing and discussing on my plotted graphs.

    DONE BY: AMINU ILIYASU BUGAJE.

  • 8/6/2019 Gui Program

    2/12

    INTRODUCTION:

    In electrical engineering, the maximum power transfer theorem states that, to

    obtain maximum external power from a source with a finite internal resistance, the resistance of

    the load must be made the same as that of the source. If the load resistance is smaller than the

    source resistance, then most of the power ends up being dissipated in the source, and although

    the total power dissipated is higher, due to a lower total resistance, it turns out that the amount

    dissipated in the load is reduced.Maximum power is transferred from an active device such as a

    power supply orbattery to an external device occurs when the impedance of the external device

    matches that of the source. (http://en.wikipedia.org/wiki/Maximum_power_theorem#References).

    Fig 1. A voltage and an internal resistance Rs supplying a load resistance RL

    In the diagram above opposite power is being transferred from the source, with voltage 240v

    and fixed source resistance Rs of 100, to a load with resistance RL, find the value of the load

    resistance RL, resulting in a current I. By Ohm's law, I is simply the source voltage divided by

    the total circuit resistance:

    The power PL dissipated in the load is the square of the current multiplied by the resistance:

    *Plot the power supply to the load as a function of the load resistance.

  • 8/6/2019 Gui Program

    3/12

    M-File Program

    Aim: Tocalculateandplotpoweragainsttheloadresistance.

    %date programmer

    %******** ***********

    %30/7/2010 Aminuiliyasu bugaje

    %variables

    V=240;%voltagesupplied

    Rs=100;%sourceresistance

    Rl=1:10:1000; % loadresistancearray

    I=V./(Rs+Rl) % calculatecurrent

    P=(I.^2).*Rl; %calcultethepowersuppliedtotheload.

    plot(Rl,P,'R'); %plotingpowersuppliedasfunctionofloadresistance.

    title('poweragainstloadresistance');

    xlabel('resistance(Rl)');

    ylabel('(power(Pl)');

    fprintf('thisisthepower value%d',P)

    I =

    Columns 1 through7

  • 8/6/2019 Gui Program

    4/12

    2.3762 2.1622 1.9835 1.8321 1.7021 1.5894 1.4907

    Columns8through 14

    1.4035 1.3260 1.2565 1.1940 1.1374 1.0860 1.0390

    Columns 15 through21

    0.9959 0.9562 0.9195 0.8856 0.8541 0.8247 0.7973

    Columns22through28

    0.7717 0.7477 0.7251 0.7038 0.6838 0.6648 0.6469

    Columns29through 35

    0.6299 0.6138 0.5985 0.5839 0.5701 0.5568 0.5442

    Columns 36through42

    0.5322 0.5206 0.5096 0.4990 0.4888 0.4790 0.4697

    Columns43 through49

    0.4607 0.4520 0.4436 0.4356 0.4278 0.4203 0.4131

    Columns 50 through 56

  • 8/6/2019 Gui Program

    5/12

    0.4061 0.3993 0.3928 0.3865 0.3803 0.3744 0.3687

    Columns 57through63

    0.3631 0.3577 0.3524 0.3473 0.3424 0.3376 0.3329

    Columns64through70

    0.3283 0.3239 0.3196 0.3154 0.3113 0.3073 0.3034

    Columns71 through77

    0.2996 0.2959 0.2923 0.2888 0.2854 0.2820 0.2787

    Columns78through84

    0.2755 0.2724 0.2694 0.2664 0.2634 0.2606 0.2578

    Columns85 through91

    0.2550 0.2524 0.2497 0.2472 0.2446 0.2422 0.2398

    Columns92through98

    0.2374 0.2351 0.2328 0.2305 0.2284 0.2262 0.2241

    Columns99through 100

  • 8/6/2019 Gui Program

    6/12

    0.2220 0.2200

    thisisthepower value5.646505e+000thisisthepower value5.142440e+001thisisthepower

    value8.261731e+001thisisthepower value1.040499e+002.

    I observed that the power is increasing and the load resistance is increasing, and the power

    started decreasing when the resistance is value was going higher . Maximum power is 150watt

    when load resistance is 100. So this shows that the higher the resistance the lower the power

    supplied. I can see that the Maximum PowerTransferoccurs in the load when the load

    resistance, RL is equal to the source resistance, RS so then: RS = RL = 100.

  • 8/6/2019 Gui Program

    7/12

    GUI PROGRAM

    function varargout = Aminu(varargin)

    % AMINU M-file for Aminu.fig% AMINU, by itself, creates a new AMINU or raises the existing% singleton*.

    %% H = AMINU returns the handle to a new AMINU or the handle to% the existing singleton*.%% AMINU('CALLBACK',hObject,eventData,handles,...) calls the local% function named CALLBACK in AMINU.M with the given input arguments.%% AMINU('Property','Value',...) creates a new AMINU or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before Aminu_OpeningFunction gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to Aminu_OpeningFcn via varargin.%% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one% instance to run (singleton)".%% See also: GUIDE, GUIDATA, GUIHANDLES

    % Edit the above text to modify the response to help Aminu

    % Last Modified by GUIDE v2.5 29-Jul-2010 21:51:58

    % Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ...

    'gui_Singleton', gui_Singleton, ...'gui_OpeningFcn', @Aminu_OpeningFcn, ...'gui_OutputFcn', @Aminu_OutputFcn, ...'gui_LayoutFcn', [] , ...'gui_Callback', []);

    if nargin && ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{1});

    end

    if nargout[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});

    elsegui_mainfcn(gui_State, varargin{:});

    end% End initialization code - DO NOT EDIT

    % --- Executes just before Aminu is made visible.function Aminu_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% varargin command line arguments to Aminu (see VARARGIN)

  • 8/6/2019 Gui Program

    8/12

    % Choose default command line output for Aminuhandles.output = hObject;

    % Update handles structureguidata(hObject, handles);

    % UIWAIT makes Aminu wait for user response (see UIRESUME)% uiwait(handles.figure1);

    % --- Outputs from this function are returned to the command line.function varargout = Aminu_OutputFcn(hObject, eventdata, handles)% varargout cell array for returning output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)

    % Get default command line output from handles structurevarargout{1} = handles.output;

    % --- Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)V=240;%voltage suppliedRs=100;%source resistanceRl=1:10:1000; % load resistance arrayI=V./(Rs+Rl) % calculate currentP=(I.^2).*Rl; %calculte the power supplied to the load.plot(Rl,P,'R'); %ploting power supplied as function of load resistance.title('power against load resistance');xlabel('resistance(Rl)');ylabel('(power(Pl)');

  • 8/6/2019 Gui Program

    9/12

    I observed that the power is increasing and the load resistance is increasing, and the power

    started decreasing when the resistance is value was going higher . Maximum power is 150 when

    load resistance is 100. So this shows that the higher the resistance the lower the power

    supplied.RL is equal to the source resistance, RS so then: RS = RL = 100. The maximum poweris transferred from an active device such as a power supply orbattery to an external device

    occurs

    when the impedance

    of the external device matches that

    of the s

    ource

  • 8/6/2019 Gui Program

    10/12

    .

    Simulink program

  • 8/6/2019 Gui Program

    11/12

    I observed that the power is increasing and the load resistance is increasing, and the power

    started decreasing when the resistance is value was going higher. So this shows that the higher

    the resistance the lower the power supplied.

    CONCLUSION:

    In the circuit above the maximum power is transferred from source resistance to a load

    resistance when the resistance of the load is same as that of the source (Rs=RL). The powerwas

    at maximum point (150) when the resistance value was low (100), and the power value started

    decreasingw

    hen the resistance valuew

    as increasing. So

    this implies that the higher theresistance the lower the power supplied and the lower the resistance the higher the power.

    The Maximum PowerTransferTheorem is another useful analysis method to ensure that the

    maximum amount of powerwill be dissipated in the load resistance when the value of the load

    resistance is exactly equal to the resistance of the power source.

  • 8/6/2019 Gui Program

    12/12

    Reference:

    1. H.W. Jackson (1959)Introduction to Electronic Circuits, Prentice-Hall.2. Sedra Adel. (1991). Microelectronic Circuits. 3 ed. Saunders College Publishing.3. http://en.wikipedia.org/wiki/Maximum_power_theorem#Maximizing_power_transfer_versus_

    power efficiency. Last accessed: 28 July 2010.

    4.

    William J. Palm III. (2005).Introduction to

    MATLAB7 for Engineers. Prentice hall

    5. Wayne storr (2010).Electronics Tutorial aboutMaximum PowerTransfer : Availableat http://www.electronics-tutorials.ws/dccircuits/dcp_9.html. last accesed:28 july 2010.