Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

AKAMPURIRA AMON

2020/A/KME/0988/F

% QUESTION 1

n=input('enter number of terms')


p=0;%sum of series
for k=1:n
p=((-1)^k)*k/2^k
end
fprintf('the sum of the series is: %f',p)
close all

%QUESTION 2
AKAMPURIRA AMON
2020/A/KME/0988/F

% QUESTION 3
function [y] = geometry(x,t)
%GEOMETRY computes the geometry of y
% inputs: x and t
y=x^2*sin(t)+2*sqrt(x)+3
end

% QUESTION 4
t=0:0.2:50;
x=5.*t.*exp(-t);
v=5.*exp((-t)) - 5.*t.*exp((-t));
a=5.*t.*exp((-t)) - 10.*exp((-t));
% x= displacement
% v= velocity
% a= acceleration
plot(t,x,'r',t,v,'b',t,a,'g')
xlabel('time (t)');
ylabel('value of x,v,a');
legend('displacement (x)', 'velocity (v)', '(acceleration (a)');
title('motion of particle');
grid on
AKAMPURIRA AMON
2020/A/KME/0988/F

% QUESTION 5
x=-5:0.1:5;
y=-5:0.1:5;
[X,Y]=meshgrid(x,y);
R=sqrt(X.^2+Y.^2)
Z=(-cos(2.*R))./(exp(0.2.*R));
mesh(X,Y,Z);
xlabel('X');
ylabel('Y');
zlabel('Z');
title('3D mesh plot of z=-(cos(2R))/(e^(0.2*R))');
view(60,45);
AKAMPURIRA AMON
2020/A/KME/0988/F

You might also like