how to have a continious sine wave in different periods

2 views (last 30 days)
hello guys,
I have created a code to generate a kind of three phases voltage drop, but i have a problem connecting between the curves in the different periods .. i dont have a problem in the first phase which its angle is 2*pi ... but in the 2 others phases where i have 2*pi/3 and -2*pi/3 i cant connect between them
  6 Comments
azerty and qwerty
azerty and qwerty on 6 Jun 2022
i tried using
plot(t1,MyVoltage1,'r', t1,MyVoltage2,'r', t1,MyVoltage3,'r', t2, MyPerturbation1+MyVoltage1(end),'b', t2, MyPerturbation2+MyVoltage2(end),'b', t2, MyPerturbation3+MyVoltage3(end),'b')
but its not working aswell
Sam Chak
Sam Chak on 6 Jun 2022
Edited: Sam Chak on 6 Jun 2022
By the way, how many cycles in between 0 and 1000 sec for a sine wave ?
t = linspace(0, 1000, 5000);
y1 = sin(2*pi*50*t);
y2 = sin(2*pi/100*t);
y = [y1' y2'];
plot(t, y)
legend('y1', 'y2')

Sign in to comment.

Accepted Answer

Sam Chak
Sam Chak on 6 Jun 2022
Think you probably want to show something like this.
Do you remember I mentioned about the points where there is a continuity when the voltages dip? I picked the points when V = 0.
fs = 10001; % Sampling Frequency in Hz
t1V1 = linspace(0, 0.30/3, fs); % Period in ms
t1V2 = linspace(0, 7/75, fs);
t1V3 = linspace(0, 8/75, fs);
MyVoltage1 = U1*sin(2*pi*f*t1V1); % Sine wave generation
MyVoltage2 = U1*sin(2*pi*f*t1V2 + 2*pi/3);
MyVoltage3 = U1*sin(2*pi*f*t1V3 - 2*pi/3);
t2V1 = linspace(0.30/3, 0.2, fs); % Period in ms
t2V2 = linspace( 7/75, 0.2, fs);
t2V3 = linspace( 8/75, 0.2, fs);
MyPerturbation1 = U2*sin(2*pi*f*t2V1); % Sine wave generation
MyPerturbation2 = U2*sin(2*pi*f*t2V2 + 2*pi/3);
MyPerturbation3 = U2*sin(2*pi*f*t2V3 - 2*pi/3);
plot(t1V1, MyVoltage1, 'r', t1V2, MyVoltage2, 'b', t1V3, MyVoltage3, 'g' , t2V1, MyPerturbation1, 'r', t2V2, MyPerturbation2, 'b', t2V3, MyPerturbation3,'g')
  2 Comments
azerty and qwerty
azerty and qwerty on 7 Jun 2022
i understand what u mean but when i need a specific period for ex from 0 to 1000 ms and if i want to change it from 0 to 500 ms .. i have to calculate the passage of 0 everytime .. there is no automatic way to do it ?
Sam Chak
Sam Chak on 7 Jun 2022
Edited: Sam Chak on 7 Jun 2022
I'm not aware of any special function, but you can definitely perform a little math and program it in the script as shown in the following example:
Solving gives
where .
Rearranging this yields
Similarly, solving and give
, and
, respectively.
tdipV1 = 500; % desired time for voltage dip to occur
n = 100*tdipV1;
tdipV2 = 1/300*(3*n - 2);
tdipV3 = 1/300*(3*(n + 1) - 4);
tstart = tdipV1 - 0.03;
tfinal = tdipV1 + 0.03;
fs = 10001;
t1V1 = linspace(tstart, tdipV1, fs);
t1V2 = linspace(tstart, tdipV2, fs);
t1V3 = linspace(tstart, tdipV3, fs);
f = 50;
U1 = 230;
U2 = 0.7*U1;
MyVoltage1 = U1*sin(2*pi*f*t1V1);
MyVoltage2 = U1*sin(2*pi*f*t1V2 + 2*pi/3);
MyVoltage3 = U1*sin(2*pi*f*t1V3 - 2*pi/3);
t2V1 = linspace(tdipV1, tfinal, fs);
t2V2 = linspace(tdipV2, tfinal, fs);
t2V3 = linspace(tdipV3, tfinal, fs);
MyPerturbation1 = U2*sin(2*pi*f*t2V1);
MyPerturbation2 = U2*sin(2*pi*f*t2V2 + 2*pi/3);
MyPerturbation3 = U2*sin(2*pi*f*t2V3 - 2*pi/3);
plot(t1V1, MyVoltage1, 'r', t1V2, MyVoltage2, 'b', t1V3, MyVoltage3, 'g' , t2V1, MyPerturbation1, 'r', t2V2, MyPerturbation2, 'b', t2V3, MyPerturbation3,'g')
grid on
xlabel('t')
ylabel('V')
title('Voltage Dip around 500 s');

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!