Answers: 1.1 Code

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Answers

Question 1:
1.1 Code

clear all;clc;close all;


format long

%% Solving integral of f(x) for x in between -4 to -1


fun1 = @(x) (4.*x.^3.*sin(2.*x));
fprintf("Integration of f(x) for x within -4 to -1\n");
intc1 = integral(fun1,-4,-1)
figure
ezplot(fun1);

%% Solving integral of f(x) for x in between 0 to 10


fun2 = @(x) (10-exp(-3.*x).*cos((4.*pi.*x)./10));
fprintf("Integration of f(x) for x within 0 to 10\n")
intc2 = integral(fun2,0,10)
figure
ezplot(fun2);

%% Adding both the integration for final value of f(x)


fprintf("Integration of f(x)\n")
int_final = intc1+intc2
hold off

1.2 Results
Value of int_final is the final result of integral i.e 1.6165e+02

Integration of f(x) for x within -4 to -1

intc1 =

61.935363086095052

Integration of f(x) for x within 0 to 10

intc2 =

99.716422985741730

Integration of f(x)

int_final =

1.616517860718368e+02
The plots of f(x) is shown above

Question 2:
2.1: Code

%% Initialise
% Converting the inputs to base units
clear all;clc;
L = 0.3 * 10^-3;
C = 0.2 * 10^-9;
R = 30;
Vo = 5*10^-3;
%% Frequency
f = 0.01:5:1000;
w = 2.*pi.* f;
%% RMS Calculation (R =30 ohm)
Vrms = (30 ./ sqrt(30.*30+(w.*L-1./w.*C).^2)).* Vo;
%% Plot
hold on;
plot(f,Vrms,'--');
title("Relation Between Vrms,f for different values of R");
xlabel("Frequency in Hz");
ylabel("RMS Voltage");
legend("R =30 Ohm");
%% RMS Calculation (R =30 ohm)
Vrms1 = (120 ./ sqrt(120.*120+(w.*L-1./w.*C).^2)).* Vo;
plot(f,Vrms1);
hold off;
legend("R =30 Ohm","R =120 Ohm");
%%

2.1: Output Plot:

From the plot we can say that the Frequency tends to increase if RMS Value goes on decreasing. And
the rate at which frequency increases is dependent on the value of resistance.
Question 3:
3.1: Model

3.2: Output Plot


Refer the plots below:

1st Plot -> Input V(t) i.e 2Sin(3t)

2nd Plot -> i(t)

3rd plot -> y(t)


Question 4:
4.1 Model
4.2 Output Plots
Input -> 4*sin(2t)

Output -> y

You might also like