MATLAB (matrix laboratory) is a multi-paradigm numerical computing environment and fourth-generation programming language. Developed by MathWorks, MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages, including C, C++, Java, and Fortran.
Consider the following program to find leap year using branching statements,
clc;
clear all;
y=input('Enter the year: ');
z=y/100; %Let z=y/100 for the years which are multiple of 100
if mod(y,100)==0 && mod(z,4)==0
display('The year is leap year');
elseif mod(y,100)~=0 && mod(y,4)==0
display('The year is leap year');
else
display('The year is not a leap year');
end
Same working can be obtained using Graphical User Interface (GUI) blocks...........
please refer following GUI layout.......
Following snapshots are some executed years in GUI..........
Following snapshots are some executed years in GUI..........
For GUI code Please refer following link.........
GUI Code
Simulink Example........
Consider following models which are made using simulink, which describes the system behavior according to value of Damping factor. Following snapshots of unit step response of the system which shows Undamped, Underdamped and Overdamped behavior of the system with variation in transfer function (Damping Factor) with the output on CRO.............
Undamped Behavior
Underdamped Behavior
Overdamped Behavior
In undamped system the output is constant amplitude sinusoidal waveform, this principle is used in Oscillator design. These type of systems are Marginal stable..........
In Underdamped system the output is exponential decay in amplitude sinusoidal waveform, These type of systems are always stable.
In Overdamped systems, there will not be any damped oscillation................
No comments:
Post a Comment