Move tp1 into its own dir, split matlab files

This commit is contained in:
flyingscorpio@arch-desktop 2022-01-06 23:32:52 +01:00
parent 6d199e82ac
commit 5c07598316
8 changed files with 66 additions and 54 deletions

View file

@ -1,54 +0,0 @@
% x1
A = ;
f0 = ;
N = ; % nombre delements de la DSF
fe = 50*N*f0;
Tps = [0 :1/fe: 1-1/fe];
a0 = 1/2;
an = (2/(n*n*pi*pi))(-cos(n*pi) + 1)
x = a0 * ones(1,length(Tps));
for n = 1:N
x = x + a0 + an*cos(n*2*pi*f0*Tps);
end
figure
plot(Tps,x);
xlabel = "t"
ylabel = "x(t)"
Title = ""
% freqentielle
X=fft(x);
Frq = [];
figure
plot(Frq,abs(X));
xlabel = "";
ylabel = "";
Title = "";
% x2
A = ;
r = ;
f0 = ;
N = ; % nombre delements de la DSF
fe = 50*N*f0;
Tps = [0 :1/fe: 1-1/fe];
a0 = r;
an = 2* (sin(n*pi*r))/(n*pi);
x = a0 * ones(1,length(Tps));
for n = 1:N
x = x + a0 + an*cos(n*2*pi*f0*Tps)+;
end
figure
plot(Tps,x);
xlabel = "t"
ylabel = "x(t)"
Title = ""
% freqentielle
X=fft(x);
Frq = [];
figure
plot(Frq,abs(X));
xlabel = "";
ylabel = "";
Title = "";

View file

@ -0,0 +1,15 @@
timestamp=$(shell date +%Y-%m-%d_%H:%M)
all: tp1
tp1: tp1.tex
@latexmk -pdf tp1.tex
@if ! cmp --silent build/tp1.pdf tp1_*.pdf; then \
touch tp1_tmp.pdf; \
rm tp1*.pdf; \
cp build/tp1.pdf tp1_${timestamp}.pdf; \
echo "Updated"; \
fi
clean:
@rm -rf build 2>/dev/null

View file

@ -0,0 +1,8 @@
% x1 frequentiel
X=fft(x);
Frq = [];
figure
plot(Frq,abs(X));
xlabel = "f";
ylabel = "Sx1(f)";
Title = "DSP de x1";

View file

@ -0,0 +1,17 @@
% x1 temporel
f0 = 2;
for N = [2,5,20,100]; % nombre delements de la DSF
fe = 50*N*f0;
Tps = [0 :1/fe: 1-1/fe];
a0 = 1/2;
x = a0 * ones(1,length(Tps));
for n = 1:N
an = (2/(n*pi)^2)*(-cos(n*pi) + 1);
x = x + a0 + an*cos(n*2*pi*f0*Tps);
end
figure
plot(Tps,x);
xlabel = "t";
ylabel = "x1(t)";
Title = "DSF de x1";
end

View file

@ -0,0 +1,8 @@
% x2 freqentiel
X=fft(x);
Frq = [];
figure
plot(Frq,abs(X));
xlabel = "f";
ylabel = "Sx2(f)";
Title = "DSP de x2";

View file

@ -0,0 +1,18 @@
% x2 temporel
r = 1/2;
f0 = 2;
for N = [2,5,20,100]; % nombre delements de la DSF
fe = 50*N*f0;
Tps = [0 :1/fe: 1-1/fe];
a0 = r;
x = a0 * ones(1,length(Tps));
for n = 1:N
an = 2*sin(n*pi*r)/(n*pi);
x = x + a0 + an*cos(n*2*pi*f0*Tps);
end
figure
plot(Tps,x);
xlabel = "t";
ylabel = "x2(t)";
Title = "DSF de x2";
end