Question
Matlab code assistance - task 1 and 6 I think I am right and just need to be pointed in the right direction if I
Matlab code assistance - task 1 and 6 I think I am right and just need to be pointed in the right direction if I should change anything
%% Task 1
% create the 3 row vectors shown in Ex 8 using 3 different approaches
Ex 8 = using the colon operator and also the linspace function, create the following row vectors
-5 -4 -3 -2 -1
5 7 9
8 6 4
% 1. list the values explicitly (square brackets)
vector1=[-5 -4 -3 -2 -1]
% 2. use the colon operator
vector2=
% 3. use the linspace function
vector3=
.
%% Task 6
% Step 1: Assign to myc the current value for time (use the built-in value, clock)
myc = clock;
% Step 2: Store the first three elements of myc in a variable named today
today = myc(1:3);
% Step 3: Store the last three elements of myc in a variable named now
now = myc(length(myc)-2:end);
% Step 4: Use the fix function on now to get the integer portion of time
int_part=fix(now);
.
%% Task 7
% create a 3d matrix having dimensions 2 x 4 x 3.
% Step 1: use the zeros function to initialize the 2 x 4 x 3 matrix
% Step 2: update mat so that the 3rd column of the 2nd layer equals 5.
% Step 3: update mat so that the element in row 2, col 4, layer 2 equals 8.
% Step 4: update mat so that row 2 on layer 2 equals 80% of its former
% value
.
%% Task 8
% Compute the sum of the first 79 terms of the harmonic series shown in Exercise 30.
% Step 1: Use the ones function to create numer, a row vector of 79 ones.
% Step 2: Create denom, a vector of the integers from 1 to 79.
% Do NOT explicitly list 79 values!
% Step 3: Use the ./ operator to compute the quotient of each element pair
% Step 4: Compute the sum of the quotients
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started