Basic Matlab Programs | Scigyan
Showing posts with label Basic Matlab Programs. Show all posts
Showing posts with label Basic Matlab Programs. Show all posts

Straight line plots

Straight-line-plots-logoMatlab program to plot Straight line
y = mx  and y = mx + c.
where m is slope (or gradient) and c is y intercept of  straight line.

Matlab code:

clc;         % Clear all input and output 
clear all; % Clear all variables 
close all; % Close all figures.

Basic trigonometry function

Basic-trigonometry-function-logoMatlab program to plot trigonometry function sine wave, cosine wave, tangent wave, cosec wave, etc. This is an example. You can plot other trigonometry function similarly.

Matlab code: 

clc;clear all;close all;
t=0:.2:15; % Time axis
% GENERATION OF SINE WAVE

Basic arithmetic operations

Basic-arithmetic-operations-logo
Matlab program for basic arithmetic operations - Addition, Subtraction, Multiplication and Division using simple matlab command.

Matlab code:

clc;            % Clear all input and output    
clear all;    % Clear all variables and objects in the matlab work-space
close all;    % Close all figures.
a=[1 2 3 4 5];    % 1st input