Uploaded by jonathanlukwichi29

LIVE SCRIPT CODE

advertisement
LIVE SCRIPT CODE
CHRISTIAN EMMANUEL LUKWICHI -222441560- BEngTech (Metallurgical Engineering)
Question 1
calls with return values
[random_value] = random_scalar(0.25,0.75) % this operation can be done three
times and it will give three different random values.
[random_value] = random_scalar(0.25,0.75)
[random_value] = random_scalar(0.25,0.75)
incorrect argument datatypes calls
[random_value] = random_scalar('a',0.75) % it returns an error and reminds the
user that both argument must be double datatype.
[random_value] = random_scalar(0.25,'b') % it returns an error and reminds the
user that both argument must be double datatype.
[random_value] = random_scalar('a','b') % it returns an error and reminds the
user that both argument must be double datatype.
matlab error reponse for incorrect amount of function arguments
[random_value] = random_scalar(0.25) % it returns an error and reminds the
user that the amount of inpout was not enough.
[random_value] = random_scalar(0.25,0.5,0.75) % it returns an error and
reminds the user that there is too many inpout arguments.
Question 2
application of the function created in question 1
[A] = random_scalar(1,10) % it returns a random number inbetween 1 and 10.
[B] = random_scalar(0.25,0.75) % it retunrs a random number inbetween 0.25
and 0.75.
input argument checks
[A] = random_scalar('a',upper) % it returns an error and reminds the user
that both argument must be double datatype.
[B] = random_scalar(0.25) % it returns an error and reminds the user that
the amount of inpout was not enough.
[B] = random_scalar(0.25,0.5,0.75) % it returns an error and reminds the
user that there is too many inpout arguments.
Question 4
[x,y] = gen_data(A,B,1,9,52)
Question 5
plot(x,y)
grid on
Question 6
visually
visually
visually
visually
visually
visually
visually
estimated
estimated
estimated
estimated
estimated
estimated
estimated
x-value
x-value
x-value
x-value
x-value
x-value
x-value
of
of
of
of
of
of
of
crossin
crossin
crossin
crossin
crossin
crossin
crossin
1
2
3
4
5
6
7
=
=
=
=
=
=
=
1
1.78
3.54
4.76
6.33
7.77
9
Download