Extract area from elipsoidal/cirle trajectory.
Dear all, how are you?
I created the following code to simulate an anticlockwise rotating trajectory forced by an external velocity. Now, I want to calculate the area each time the trajectory makes a closed circle, as described in the attached image. I would appreciate any help in finding the best way to identify the areas inside the circles for each loop/circle in the trajectory. Thanks for your time!
clear all,close all;
Fs = 1/0.5;
duration_hours = 25 * 24;
t = 0:1/Fs:duration_hours;
period = 20;
phase = -pi/2;
num_periods = floor(duration_hours / period);
amplitudes = 0.1/2 + 0.1 * rand(1, num_periods); % Random amplitudes between 0.1 and 0.3
y = zeros(size(t));
for i = 1:num_periods
start_idx = (i-1) * period * Fs + 1;
end_idx = i * period * Fs;
uI(start_idx:end_idx) = amplitudes(i) * sin(2*pi*(t(start_idx:end_idx) – t(start_idx))/period);
end
amplitudes = 0.1/2 + 0.1 * rand(1, num_periods); % Random amplitudes between 0.1 and 0.3
for i = 1:num_periods
start_idx = (i-1) * period * Fs + 1;
end_idx = i * period * Fs;
vI(start_idx:end_idx) = amplitudes(i) * sin(2*pi*(t(start_idx:end_idx) – t(start_idx))/period);
end
uI = uI(10:end);
vI = vI(1:length(uI));
cv = complex(uI*100,vI*100);
dt=0.5/24;
dt=dt*3600*24;
cxI=cumsum(cv)*dt;
cxI=cxI/100/1000;
x = real(cxI + complex(cumsum(repmat(0.1,1191,1)),0)’ );
y = imag(cxI + complex(cumsum(repmat(0.1,1191,1)),0)’ );
clearvars -except x y;
plot(x,y),axis equal;Dear all, how are you?
I created the following code to simulate an anticlockwise rotating trajectory forced by an external velocity. Now, I want to calculate the area each time the trajectory makes a closed circle, as described in the attached image. I would appreciate any help in finding the best way to identify the areas inside the circles for each loop/circle in the trajectory. Thanks for your time!
clear all,close all;
Fs = 1/0.5;
duration_hours = 25 * 24;
t = 0:1/Fs:duration_hours;
period = 20;
phase = -pi/2;
num_periods = floor(duration_hours / period);
amplitudes = 0.1/2 + 0.1 * rand(1, num_periods); % Random amplitudes between 0.1 and 0.3
y = zeros(size(t));
for i = 1:num_periods
start_idx = (i-1) * period * Fs + 1;
end_idx = i * period * Fs;
uI(start_idx:end_idx) = amplitudes(i) * sin(2*pi*(t(start_idx:end_idx) – t(start_idx))/period);
end
amplitudes = 0.1/2 + 0.1 * rand(1, num_periods); % Random amplitudes between 0.1 and 0.3
for i = 1:num_periods
start_idx = (i-1) * period * Fs + 1;
end_idx = i * period * Fs;
vI(start_idx:end_idx) = amplitudes(i) * sin(2*pi*(t(start_idx:end_idx) – t(start_idx))/period);
end
uI = uI(10:end);
vI = vI(1:length(uI));
cv = complex(uI*100,vI*100);
dt=0.5/24;
dt=dt*3600*24;
cxI=cumsum(cv)*dt;
cxI=cxI/100/1000;
x = real(cxI + complex(cumsum(repmat(0.1,1191,1)),0)’ );
y = imag(cxI + complex(cumsum(repmat(0.1,1191,1)),0)’ );
clearvars -except x y;
plot(x,y),axis equal; Dear all, how are you?
I created the following code to simulate an anticlockwise rotating trajectory forced by an external velocity. Now, I want to calculate the area each time the trajectory makes a closed circle, as described in the attached image. I would appreciate any help in finding the best way to identify the areas inside the circles for each loop/circle in the trajectory. Thanks for your time!
clear all,close all;
Fs = 1/0.5;
duration_hours = 25 * 24;
t = 0:1/Fs:duration_hours;
period = 20;
phase = -pi/2;
num_periods = floor(duration_hours / period);
amplitudes = 0.1/2 + 0.1 * rand(1, num_periods); % Random amplitudes between 0.1 and 0.3
y = zeros(size(t));
for i = 1:num_periods
start_idx = (i-1) * period * Fs + 1;
end_idx = i * period * Fs;
uI(start_idx:end_idx) = amplitudes(i) * sin(2*pi*(t(start_idx:end_idx) – t(start_idx))/period);
end
amplitudes = 0.1/2 + 0.1 * rand(1, num_periods); % Random amplitudes between 0.1 and 0.3
for i = 1:num_periods
start_idx = (i-1) * period * Fs + 1;
end_idx = i * period * Fs;
vI(start_idx:end_idx) = amplitudes(i) * sin(2*pi*(t(start_idx:end_idx) – t(start_idx))/period);
end
uI = uI(10:end);
vI = vI(1:length(uI));
cv = complex(uI*100,vI*100);
dt=0.5/24;
dt=dt*3600*24;
cxI=cumsum(cv)*dt;
cxI=cxI/100/1000;
x = real(cxI + complex(cumsum(repmat(0.1,1191,1)),0)’ );
y = imag(cxI + complex(cumsum(repmat(0.1,1191,1)),0)’ );
clearvars -except x y;
plot(x,y),axis equal; matlab, time series MATLAB Answers — New Questions