Hi all,
At t=0:0.1:10*pi,
I am getting multiple lines at v=1.5 and v=-1.5 when I tried to plot for
voltage versus current when I run my code.
But If I increase the sampling interval, multiple lines occuring at v=1.5 and v=-1.5 are eliminated.
For eg,
For t=0:0.00001:10*pi
I want to reason behind the occurence of multiple lines for t=0:0.1:10*pi.
Can anyone help me.
Thanks.
I attached my code below,
clc;clear all; close all;w=1;M1=2e6;M2=2e9;t=0:0.1:10*pi;M = M2;for i=1:length(t) v(i)=2*sin(w*t(i)); if (v(i)>=1.5) M = M1; elseif (v(i)<=-1.5) M = M2; end I(i)= v(i)/M; endfigure(1)plot(t, v,'r');hold on;plot(t, I*1000000,'b');legend('voltage','current','Location','northeast');title('Voltage & Current vs time')grid on;figure(2)plot(v, I);title('Voltage vs Current');xlabel('Voltage');ylabel('Current');
Best Answer