diff options
author | Siddharth Agarwal | 2019-09-03 18:27:40 +0530 |
---|---|---|
committer | Siddharth Agarwal | 2019-09-03 18:27:40 +0530 |
commit | 8ac15bc5efafa2afc053c293152605b0e6ae60ff (patch) | |
tree | e1bc17aae137922b1ee990f17aae4a6cb15b7d87 /Working_Examples/293/CH2/EX2.6/eg2_6.sce | |
parent | 52a477ec613900885e29c4a0b02806a415b4f83a (diff) | |
download | Xcos_block_examples-master.tar.gz Xcos_block_examples-master.tar.bz2 Xcos_block_examples-master.zip |
Diffstat (limited to 'Working_Examples/293/CH2/EX2.6/eg2_6.sce')
-rwxr-xr-x | Working_Examples/293/CH2/EX2.6/eg2_6.sce | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Working_Examples/293/CH2/EX2.6/eg2_6.sce b/Working_Examples/293/CH2/EX2.6/eg2_6.sce new file mode 100755 index 0000000..5094d17 --- /dev/null +++ b/Working_Examples/293/CH2/EX2.6/eg2_6.sce @@ -0,0 +1,26 @@ +C = 0.01; // capacitance of the capacitor in Farads
+t1 = [0:0.001:0.1];
+t2 = [0.101:0.001:0.3];
+t3 = [0.301:0.001:0.6];
+t4 = [0.601:0.001:0.7];
+t5 = [0.701:0.001:0.9]
+//current variation as a function of time
+i1 = 100*t1;
+i2 = (-50*t2) + 15;
+i3 = -100*sin(%pi*(t3-0.3)/0.3);
+i4 = (100*t4) - 60;
+i5 = (-50*t5) + 45;
+
+t = [t1,t2,t3,t4,t5];
+i = [i1,i2,i3,i4,i5];
+plot(t, i)
+
+// voltage across the capacitor as a function of time
+V1 = (1/C)*integrate('100*t','t',0,t1);
+V2 = (1/C)*integrate('(-50*t)+15','t',0.101,t2);
+V3 = (1/C)*integrate('-100*sin(%pi*(t-0.3)/0.3)','t',0.301,t3);
+V4 = (1/C)*integrate('(100*t) - 60','t',0.601,t4);
+V5 = (1/C)*integrate('(-50*t) + 45','t',0.701,t5);
+V = [V1, V2, V3, V4, V5];
+
+plot(t, V, "green")
\ No newline at end of file |