0% found this document useful (0 votes)
6 views

Solved Problem Java

This the solved problem of Java programing

Uploaded by

momainali0786
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Solved Problem Java

This the solved problem of Java programing

Uploaded by

momainali0786
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

KHUDA BUX

FL 210097

S& S LAB REPORTS

LAB NO#01 (All Tasks)

f=(1+sqrt (5))/2

x=-5+9i

y=6-2i

x+y

x*y

x-y

x/y

abs(x+y)
6*(35^(1/4))+(14^0.35)

TASK 01

roll_number=210097
x=24+(210097)
y=10+(210097)
z=-2+(210097)
y/x*z
y/(x*z)
sqrt(24+(210097))
sqrt(10+(210097))
sqrt(-2+(210097))
sin (pi/3)

cos (pi/4)

tan (pi/2)

asin (0)

abs (z)

log(x)

exp (y)
a=[1,2+(210097),3,4+(210097),5,6+(210097)]

untitled2
a=

1 210086 3 210088 5 210090

b=a'

untitled2

a=

1 210086 3 210088 5 210090

untitled2

b=

1
210086
3
210088
5
210090

clc
f=(1+sqrt(5))/2

x=-5+9i
y=6-2i
x+y
x*y
x-y
x/y
abs(x+y)

6*(35^(1/4))+(14^0.35)

%% lab-1 task-1
roll_number=210097
x=24+(210097)
y=10+(210097)
z=-2+(210097)
y/x*z
y/(x*z)
%% lab-1 task-2
sqrt(24+(210097))
sqrt(10+(210097))
sqrt(-2+(210097))

%% lab-1 task-3
sin (pi/3)
cos (pi/4)
tan (pi/2)
asin (0)
abs (z)
log(x)
exp (y)
%% lab-1 task-4
a=[1,2+(210097),3,4+(210097),5,6+(210097)]
%% lab-1 task-5
b=a'
%% lab-1 task-6
a=[1,3,5,9]
b=a'
c=a
c(1)
c(3)
c(end-1)=b(end)
%% lab-1 task-7
A=[3,9,084,7;-7,18,084,2;0,11,084,13;9,6,084,-2]
b=a'
%% lab-1 task-8
b=a'
A(1,:)=b
%% lab-1 task-9
A(end,:)=b
%% lab-1 task-10
linspace(-pi/2,pi/2,15)
linspace(2,5,10)

KHUDA BUX

FL210097

S & S LAB REPORTS


LAB N0# 02

r=rand(1,50)
plot(r)

figure

w=rand(1,50)
plot(w)

Columns 1 through 18

0.8147 0.9058 0.1270 0.9134 0.6324 0.0975 0.2785 0.5469 0.9575


0.9649 0.1576 0.9706 0.9572 0.4854 0.8003 0.1419 0.4218 0.9157

Columns 19 through 36

0.7922 0.9595 0.6557 0.0357 0.8491 0.9340 0.6787 0.7577 0.7431


0.3922 0.6555 0.1712 0.7060 0.0318 0.2769 0.0462 0.0971 0.8235

Columns 37 through 50

0.6948 0.3171 0.9502 0.0344 0.4387 0.3816 0.7655 0.7952 0.1869


0.4898 0.4456 0.6463 0.7094 0.7547
function y=sum_of_numb(r)

y=sum(r);
end

function y=average_of_number(r,n)
y=sum(r)/n;

end

r=rand(1,50);
plot(r)

figure

w=rand(1,50);
plot(w)

%%

n=500

r=rand(1,n);
s=sum_of_numb(r);

a=average_of_number(r,n)

%%

if rand >=0.5
r=1

else

r=0
end
%%

s=rand
if s <0.25

r=0

elseif s>=0.25 && 5<0.75


r=1

else

r=2
end

%%

n=10
for i=1:n

s= i*i

end

%%
n=10

for i=1:n

s(i)= i*i

end
%%

r=84;

for Tc=0:10+r:200+r;
Tf=9/5*Tc+32
end

Tf =

32

Tf =

201.2000

Tf =

370.4000

Tf =

539.6000

rn=200;
e=0;

x=5;

for n=0:rn;

e=x^n/factorial(n)+0
end

b=exp(x
KHUDA BUX

FL210097

S & S LAB REPORT

LAB NO # 03
f=1;

t=0:0.001:10;

A=2;
x1=A*sin(2*pi*f*t);
x2=A*cos(2*pi*f*t);

plot(t,x1)

figure
plot(t,x2)
A=2;

f=1;
n=0:10;

theta=0;

x=A*sin(f*n+theta);
stem(n,x);

%%
f=25;

x=round(rand(1,f));
stem(x)

%%

f=1;

t=0:0.001:10;

A=2;
x=A*exp(-f*t);
plot(t,x)

%%

n=10;

x=round(rand(1,n));
stem(x)
KHUDA BUX
FL210097

S & S LAB REPORT

LAB NO #06

x=[-3 -1 0 7 2]

h=[-1 0 1]

y=conv(x,h)

subplot (311)
stem(x)

subplot (312)

stem(h)
subplot (313)

stem(y)

untitled2

x =

-3 -1 0 7 2

h =

-1 0 1

y =
3 1 -3 -8 -2 7 2

KHUDA BUX

FL210097

S & S LAB REPORT

LAB NO #05

close all
clear
clc
%% unit impulse

n=-5:5;
x=zeros(1,numel(n))

x(round(numel(n)/2))=1;

stem(n,x)
xlabel('n')

ylabel('Amplitude')

title('Unit impulse')

x=

Columns 1 through 7

0 0 0 0 0 0 0

Columns 8 through 11

0 0 0 0
%%

n=-5:5;
n0=2;

x=zeros(1,numel(n))
x(round(numel(n)/2)+n0)=1;

stem(n,x)

xlabel('n')

ylabel('Amplitude')

title('Unit impulse')
Columns 1 through 7

0 0 0 0 0 0 0

Columns 8 through 11

0 0 0 0

%%
n=-5:5;

n0=-2;
x=zeros(1,numel(n))

x(round(numel(n)/2)+n0)=1;

stem(n,x)
xlabel('n')

ylabel('Amplitude')

title('Unit impulse')

x=

Columns 1 through 7

0 0 0 0 0 0 0

Columns 8 through 11

0 0 0 0
n=-5:5;
n0=-2;

x=zeros(1,numel(n))
x(round(numel(n)/2):end)=1;

stem(n,x)

xlabel('n')

ylabel('Amplitude')
title('Unit step')
Columns 1 through 7

0 0 0 0 0 0 0

Columns 8 through 11

0 0 0 0
n=-5:5;

n0=-2;
x=zeros(1,numel(n))

x(round(numel(n)/2)+n0:end)=1;

stem(n,x)
xlabel('n')

ylabel('Amplitude')

title('Unit step')

x=

Columns 1 through 7

0 0 0 0 0 0 0

Columns 8 through 11

0 0 0 0
%%

n=-5:5;
x=n;

stem(n,x)
xlabel('n')
ylabel('Amplitude')
title('Unit step')

x=

Columns 1 through 7

0 0 0 0 0 0 0

Columns 8 through 11

0 0 0 0
n=-3:3;
x=0.1.^n;

stem(n,x)
xlabel('n')

ylabel('Amplitude')

title('Unit step')

x=
Columns 1 through 7

0 0 0 0 0 0 0

Columns 8 through 11

0 0 0 0

LAB NO #06
x=[-3 -1 0 7 2]

h=[-1 0 1]
y=conv(x,h)

subplot (311)

stem(x)
subplot (312)

stem(h)

subplot (313)
stem(y)

untitled2

x =

-3 -1 0 7 2

h =

-1 0 1

y =

3 1 -3 -8 -2 7 2
KHUDA BUX

FL 2100097

S & S LAB REPORT

LAB NO # 12
KHUDA BUX
FL210097

S & S LAB REPORT

You might also like