Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(30 Points) Design a MATLAB script to tabulate values for the function V e t/T c

ID: 3813304 • Letter: #

Question

(30 Points) Design a MATLAB script to tabulate values for the function V e t/T cos 0t, a common type of voltage response in electric circuits. The user should be asked to enter the following parameters: t-time constant in seconds e frequency in radians per second to initial time in seconds tf final time in seconds Steps -number of divisions into which the range of time is to be divided The program should print a statement similar to the following: Calculations of the equation e (-t/x.xxx) cos (x.xxx t) from x.xx x to x xxx seconds The program should calculate the value of V [voltage for the stated values of T and e over the range of time from to to tf. The results should be printed in a neatly formatted table showing both time and voltage.

Explanation / Answer

Matlab code:

clc;
clear all;
tau = input('Enter Time constant in seconds!');
theta = input('Enter frequency in radians per second!');
to = input('Enter to! in seconds');
tf = input('Enter tf in seconds!');
dt = to = input('Enter stepsize!');

t = to:dt:tf;
for i = 1:size(t,2)
f(i) = exp((-t(i)/tau))*cos(theta*t(i));
end
fprintf('t F(t) ');
for i = 1:size(t,2)
fprintf('%d %d ', t(i), f(i));
end

Sample Output: