sinusoidal figure OK

This commit is contained in:
drowe67 2023-11-19 19:11:10 +10:30 committed by David Rowe
parent def80d4bf6
commit f778670d0c
3 changed files with 15 additions and 7 deletions

Binary file not shown.

View file

@ -87,10 +87,11 @@ A sinewave will cause a spike or spectral line on a spectrum plot, so we can see
(#1+2*#3,#2+0)}
}
% three sine wave sources
\draw (0, 2.0) circle (0.5); \drawSine{0}{ 2.0}{0.2}{0.2};
\draw (0, 0.5) circle (0.5); \drawSine{0}{ 0.5}{0.2}{0.2};
\draw (0,-1.5) circle (0.5); \drawSine{0}{-1.5}{0.2}{0.2};
% sine wave sources
\draw (0, 2.0) circle (0.5); \drawSine{0}{ 2.0}{0.2}{0.2}; \draw (-2.0,2.0) node {$A_1, F_0$ Hz};
\draw (0, 0.5) circle (0.5); \drawSine{0}{ 0.5}{0.2}{0.2}; \draw (-2.0,0.5) node {$A_2, 2F_0$ Hz};
\draw (0,-2.5) circle (0.5); \drawSine{0}{-2.5}{0.2}{0.2}; \draw (-2.0,-2.5) node {$A_L, LF_0$ Hz};
\draw [dotted,thick] (0,0) -- (0,-2);
% summer
\draw (2.5,2) circle (0.5);
@ -100,11 +101,11 @@ A sinewave will cause a spike or spectral line on a spectrum plot, so we can see
% connecting lines
\draw [->] (0.5,2) -- (2,2);
\draw [->] (0.45,0.7) -- (2.05,1.8);
\draw [->] (0.3,-1.1) -- (2.2,1.6);
\draw [->] (0.3,-2.1) -- (2.2,1.6);
% output
% output speec
\draw [->] (3,2) -- (4,2);
\draw [xshift=4.2cm,yshift=2cm,color=blue] plot[smooth] file {hts2a_37_sn.txt};
\end{tikzpicture}
\end{center}

View file

@ -92,6 +92,13 @@ function plamp(samname, f, epslatex=0)
fn = sprintf("%s_%d_sn.tex",samname,f);
print(fn,"-depslatex",sz); printf("\nprinting... %s\n", fn);
% file of points to plot in sinusoidal model
fn = sprintf("%s_%d_sn.txt",samname,f);
t_length = 4; s_max = 2; s=s*s_max/max(abs(s));
N = length(s); t = (0:N-1)*t_length/N;
s_save = [t' s']; size(s_save)
save("-ascii",fn,"s_save"); printf("printing... %s\n", fn);
figure(2);
fn = sprintf("%s_%d_sw.tex",samname,f);
print(fn,"-depslatex",sz); printf("printing... %s\n", fn);