MATLAB Program Ch 1- variation on 12 Gencrate a real number in the range (0,120)
ID: 3880244 • Letter: M
Question
MATLAB Program
Ch 1- variation on 12 Gencrate a real number in the range (0,120) Generate a real number in the range (42,88) Generate an integer in the inclusive range from 1 to 80 Generate an integer in the inclusive range from 0 to 30 Generate an integer in the inclusive range from -15 to 85 Ch a. Shift the string 'gas' down in the character encoding by 2 characters. b. Shift the string 'cat' up in the character encoding by 5 characters. Ch 1 - variation on 19 Create two variables x and y and store numbers in them. Write an expression that would be true if the value of x is greater than or equal to 6 or if the value of y is less than or equal to 17, but not if both of those are true (and not true if neither is true). Change the values in the variables and test the expression again- do this until all 4 combinations of T/F have been tested. Ch 1--#32 Set desired weight to 180, N to 4 (%). Create variable MinWt to store the minimum weight and create variable MaxWt to store the maximum weight Ch2_ #18Explanation / Answer
(0,120)
a=0;
b=120;
out=a+(b-a)*rand
(42,88)
a=42;
b=88;
out=a+(b-a)*rand
(1,80)
n = 80;
l = 1;
out = randperm(n,l)
(0,30)
n = 30;
l = 0;
out = randperm(n,l)
(-15,85)
n = 85;
l = -15;
out = randperm(n,l)
A = 'gas';
Y = circshift(A,2)
A = 'cat';
Y = circshift(A,5)
x = 10;
y = 15;
if x >= 6 || y <= 17
print True
weight = 180;
N = 0.04;
MinWt = weight - (N * weight)
MaxWt = weight + (N * weight)
**Comment for any further queries.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.