0% found this document useful (0 votes)
37 views15 pages

To Enter An Expression and Solve

This document contains MATLAB code to perform various tasks like entering and solving expressions, working with matrices, solving simultaneous equations, plotting graphs, and using plotting functions. It includes code to input values, calculate determinants, transposes, inverses, solve equations, plot sine waves and multiple functions, and use plotting functions like fplot, ezplot, and ezsurfc. The code is run on a personal computer with MATLAB software to demonstrate these tasks.

Uploaded by

Anonymous s11l7v
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views15 pages

To Enter An Expression and Solve

This document contains MATLAB code to perform various tasks like entering and solving expressions, working with matrices, solving simultaneous equations, plotting graphs, and using plotting functions. It includes code to input values, calculate determinants, transposes, inverses, solve equations, plot sine waves and multiple functions, and use plotting functions like fplot, ezplot, and ezsurfc. The code is run on a personal computer with MATLAB software to demonstrate these tasks.

Uploaded by

Anonymous s11l7v
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

TO ENTER AN EXPRESSION AND SOLVE

Aim: to enter an expression and solve using matlab software


Apparatus: personal computer
Matlab software
Program:
clc;
close all;
clear all;
x=input('enter value of x');
y=x^2+sin(x);
z=cos(x);
Answer=y/z

Result:

TO WORK WITH ARRAYS AND MATRICES


Aim: to find determinant, transpose, inverse of the matrix
Apparatus: personal computer
Matlab software
Programme:
clc;
clear all;
close all;
x=input('enter matrix x=');
disp('given matrix is=');
disp(x);
y=det(x);
disp('det of matrix is=');
disp(y);
z=x';
disp('transpose of matrix is=');
disp(z);
i=inv(x);
disp('inverse of matrix is=');
disp(i);

Result:

TO SOLVE SIMULTANEOUS EQUATIONS USING MATLAB


Aim: To Solve simultaneous equations using Matlab
Apparatus: personal computer
Matlab software
Programme:
clc;
clear all;
close all;
A=input('enter coefficient matrix A=');
B=input('enter constant matrix B=');
X=inv(A)*B;
disp('solution to the given equations is=');
disp(X);

RESULT:

TO SOLVE FOR CURRENTS IN AN ELECTRICAL CIRCUIT USING


KIRCHOFFS LAWS USING MATLAB

Aim: To solve for currents in an electrical circuit using kirchoffs laws using matlab
Apparatus: personal computer
Matlab software
Electrical Circuit:

Programme:
clc;
clear all;
close all;
A=input('enter coefficient matrix A=');
B=input('enter constant matrix B=');
I=inv(A)*B;
disp('currents in the meshs is=');
disp(I);
Result:

TO PLOT A GRAPH BETWEEN TWO VARIABLES


Aim: To plot sine wave using matlab
Apparatus: personal computer
Matlab software
Program:
clc;
close all;
clear all;
t=0:0.001:1;
f=input('enter value of frequency');
a=input('enter value of amplitute');
y=a*sin(2*pi*f*t);
plot(t,y);
xlabel('time');
ylabel('sine wave');
title('sine wave');

Result:

TO PLOT MULTIPLE FUNCTIONS AND ADD TITLE AND LABELS

Aim: To plot sine, cosine, ramp, step square signals in single plot
Apparatus: personal computer
Matlab software
Program:

TO USE FPLOT, EZPLOT AND EZSURFC FUNCTIONS


Aim: To use fplot , ezplotand ezsurfc functions
To publish a report in word file
Apparatus: personal computer
Matlab software
Program:
clc;
clear all;
close all;
figure;
fplot('exp(-.1*x).*sin(x)',[0 20]);
xlabel('x');
ylabel('functon');
title('plot using fplot command');
figure;
ezplot('exp(-.1*x).*cos(x)',[0 20]);
xlabel('x');
ylabel('functon');
title('plot using ezplot command');
figure;
z='-5./(1+x.^2+y.^2)';
ezsurf(z,[-3,3,-3,3])
xlabel('x');

ylabel('y');
zlabel('z');
title('plot using ezsurf command');
figure;
z='-5./(1+x.^2+y.^2)';
ezsurfc(z,[-3,3,-3,3])
xlabel('x');
ylabel('y');
zlabel('z');
title('plot using ezsurfc command');
Publishing Report:
To publish a report go to FILEPUBLISH filename.m
Results:

You might also like