Answer:
awnsers should be added to know to show additional
Answer:
Explanation gives the answer
Explanation:
% Using MATLAB,
% Matlab file : fieldtovar.m
function varargout = fieldtovar(S)
% function that accepts single structure as input, assigning each
% of the field values to user-defined variables
fields = fieldnames(S); % get the field names of the input structure
% check if number of user-defined variables and number of fields in
% structure are equal
if nargout == length(fields)
% if equal assign each value of structure to user-defined varable
for i=1:nargout
varargout{i} = getfield(S,fields{i});
end
else
% if not equal display an error message
error('The number of output variables does not equal the number of fields');
end
end
%This brings an end to the program
Answer:
The angular velocity is 7.56 rad/s
the maximum water height is 2 ft
Explanation:
The z-position as a function of r is equal to
(eq. 1)
where
h0 = initial height = 1 ft
w = angular velocity
R = radius of the cylinder = 1.5 ft
zs(r) = 0 when the free surface is lowest at the centre
Replacing and clearing w

if you consider the equation 1 for the free surface at the edge is equal to

Answer:
Codes for each of the problems are explained below
Explanation:
PROBLEM 1 IN C++:
#include<iostream>
using namespace std;
//fib function that calculate nth integer of the fibonacci sequence.
void fib(int n){
// l and r inital fibonacci values for n=1 and n=2;
int l=1,r=1,c;
//if n==1 or n==2 then print 1.
if(n==1 || n==2){
cout << 1;
return;
}
//for loop runs n-2 times and calculates nth integer of fibonacci sequence.
for(int i=0;i<n-2;i++){
c=l+r;
l=r;
r=c;
cout << "(" << i << "," << c << ") ";
}
//prints nth integer of the fibonacci sequence stored in c.
cout << "\n" << c;
}
int main(){
int n; //declared variable n
cin >> n; //inputs n to find nth integer of the fibonacci sequence.
fib(n);//calls function fib to calculate and print fibonacci number.
}
PROBLEM 2 IN PYTHON:
def fib(n):
print("fib({})".format(n), end=' ')
if n <= 1:
return n
else:
return fib(n - 1) + fib(n - 2)
if __name__ == '__main__':
n = int(input())
result = fib(n)
print()
print(result)