summaryrefslogtreecommitdiff
path: root/coursework17/ralston_script.m
diff options
context:
space:
mode:
Diffstat (limited to 'coursework17/ralston_script.m')
-rw-r--r--coursework17/ralston_script.m10
1 files changed, 8 insertions, 2 deletions
diff --git a/coursework17/ralston_script.m b/coursework17/ralston_script.m
index 9db929f..ce9240a 100644
--- a/coursework17/ralston_script.m
+++ b/coursework17/ralston_script.m
@@ -14,20 +14,23 @@ current_initial=0;
[t, Vout] = ralston(R, L, Vin, current_initial, step, data_points*step);
plot(t, Vout);
+figure;
% Signal 2a Vin = 5.5*exp(-t^2/r) V
-Vin = @(t) 5.5*exp(-(t*160*10^(-6))^2) % 5.5V
+Vin = @(t) 5.5*exp(-t^2/(160e-6)) % 5.5V
current_initial=0;
[t, Vout] = ralston(R, L, Vin, current_initial, step, data_points*step);
plot(t, Vout);
+figure;
% Signal 2b Vin = 5.5*exp(-t/r)
-Vin = @(t) 5.5*exp(-t*160*10^(-6)) % 5.5V
+Vin = @(t) 5.5*exp(-t/(160e-6)) % 5.5V
current_initial=0;
[t, Vout] = ralston(R, L, Vin, current_initial, step, data_points*step);
plot(t, Vout);
+figure;
% Signal 3
T(1) = 20e-6; % 20us
@@ -39,12 +42,15 @@ for j=1:3
Vin = @(t) sin(2*pi*f*t);
[t, Vout] = ralston(R, L, Vin, current_initial, step, data_points*step);
plot(t, Vout);
+ figure;
Vin = @(t) sawtooth(2*pi*f*t);
[t, Vout] = ralston(R, L, Vin, current_initial, step, data_points*step);
plot(t, Vout);
+ figure;
Vin = @(t) square(2*pi*f*t);
[t, Vout] = ralston(R, L, Vin, current_initial, step, data_points*step);
plot(t, Vout);
+ figure;
end