Beruflich Dokumente
Kultur Dokumente
When r = [ 2 -1 ], what is the value of 14. Show the results generated by the
output? MATLAB command for n = 3 and
n=4.
while n>1 20. Show the results generated by the
disp(I dunno) MATLAB command:
if rem(n,2)==0
n = n/2; a = 1; b = 2; c = 3; d = 4;
else plot([a c],[b d])
n = 3*n+1;
end 21. Write a MATLAB command that
end generates 100 uniform random numbers
between -7 and +7?
15. Show the last line of output generated by
the following MATLAB command 22. Write a MATLAB program that plot the
function y = sin(x) across [0,2pi] but add
x = 1; random noise if
y = x; 2 4
x
while y==x && x<=4 && y<=4 3 3
x = 2*x
end
16. Show the results generated by the 23. Write the MATLAB commands to
following MATLAB command generate a table of conversions from
seconds to minutes. The range of
x = [10 20 30]; seconds should be from 0 to 60 min
y = [3 1 2]; increments of 3.
k = y(3)-1;
z = x(k+1) 24. Write a MATLAB function that accepts
time t as an input and returns a voltage
17. Given the function, then generate a plot of v = e-tcos(t).
function y = f(x)
x = x+1; 25. Write a MATLAB program that outputs
y = x+1; the velocity vs time graph and position
vs time graph of SHM.
Show the results generated by the
MATLAB command: 26. Write a MATLAB script that output the
same as linspace(1,5,5) ?
x = 1;
x = f(x+1); 27. Write a MATLAB command using the
y = x+1 built-in command linspace to produce
this array.
18. Show the results generated by the
MATLAB command and write x = [ 0 .25 .50 .75 1.00]
comments to this script:
28. Write a MATLAB script that will output
x = [ ]; a triangle.
for k=1:50
if floor(sqrt(k))==sqrt(k) 29. Write a MATLAB command using the
x = [x; k]; built-in command DrawStar to produce
end this figure:
end
x=x
for k = 1:3
disp(I am)
k= 5;
disp(great)
end