Name: Olabode Ayomide Matthew
Matric No: CHE/2019/037
Department: Chemical Engineering
% Charge in a RLC circuit
% Q = initial charge
% q = charge at time, t
% Define the symbolic variables
syms t R C L q Q
% Define the expression for q(t)
q = Q * exp(-R * t / (2 * L)) * cos(sqrt(1 / (L * C) - (R / (2 * L))^2) * t);
% Define numerical values for the parameters
Q = 10;
R = 60;
L = 9;
C = 0.00005;
% Create a time vector from 0 to 0.8 with small intervals for better accuracy
t = 0:0.005:0.8;
% Substitute the values into the symbolic expression
q_numeric = double(subs(q));
% Plot the charge q(t) against time t
figure;
plot(t, q_numeric, 'LineWidth', 2);
title('Plot of Charge against Time in an RLC Circuit');
xlabel('Time’);
ylabel('Charge (Coulombs);
grid on;
set(gca);
2. % Define the standard normal probability density function
syms z
f = (1/sqrt(2*pi)) * exp((-z^2) / 2);
% Define the range for z
z_vals = -5:0.1:5;
% Evaluate the function over the range of z values
f_vals = double(subs(f, z, z_vals));
% Plot the function
figure;
plot(z_vals, f_vals, 'LineWidth', 2);
title('Standard Normal Probability Density Curve');
xlabel('z');
ylabel('Frequency');
grid on;
set(gca);
3. % F = Force(N)
% x = Displacement(m)
% k = Spring constant (N/m)
% U = Potential Energy Stored In The Spring (J)
% Given data
F = [14, 18, 8, 9, 13]; % Force in Newtons
x = [0.013, 0.02, 0.009, 0.01, 0.012]; % Displacement in meters
% Compute spring constants (k)
k = F ./ x;
% Compute potential energies (U)
U = 0.5 * k .* x.^2;
% Determine the maximum potential energy
max_U = max(U);
% Display results
disp('Spring constants (k):');
disp(k);
disp('Potential energies (U):');
disp(U);
disp('Maximum potential energy (U_max):');
disp(max_U);
4. % d = density (g/cm^3)
% T_C = Temperature (degC)
% T_F = Temperature (degF)
% Generate a vector of temperatures in °F
T_F = 32:3.6:93.2;
% Convert this vector to degrees Celsius
T_C = (5/9) * (T_F - 32);
% Compute the density using the given cubic equation
d = 5.5289e-8 * T_C.^3 - 8.5016e-6 * T_C.^2 + 6.5622e-5 * T_C + 0.99987;
% Plot density (d) versus temperature (T_C)
plot(T_C, d, 'LineWidth', 2);
title('Plot of Density (g/cm^3) against Temperature (degC)');
xlabel('Temperature (degC)');
ylabel('Density (g/cm^3)');
grid on;
set(gca);