Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

MathScript Workshop

Pengolahan Sinyal
[Document subtitle]

3110171046
AGUNG PURWANTO
 Exercise Number 1
 Coding di Mathscript

 Output Program
 Excersise Number 2

The program is used to change the negative number into positif

1. Is check the length of array and store it to variable called L


2. Variable L is used for itteration
3. Checking is the x value less than zero ? if true then times with -1

x=randint(1, 100,[-100 100]);


x' % print the first value of x
i=1;
while (i<=length(x))
if (x(i) < 0)
x(i) = -x(i);
end
i=i+1;
end
x' % print the final value of x

 Excersise Number 3
x=rand(1,1000);
y=zeros(1,1000);
for i=1:length(x)
if (x(i) < -0.2)
y(i) = -0.2;
elseif (x(i) >= 0.2)
y(i) = .2;
else
y(i) = x(i);
end
end
x' % print x
y' % print y

 Excersise Number 4
 Coding in Mathscript

You might also like