Skip to content

Commit 098f274

Browse files
committed
update chirp doc page
1 parent b1daf98 commit 098f274

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

‎docs/src/input_signals.md‎

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ chirp
5353

5454
```@example input_signals
5555
# Generate chirp signals
56-
N = 1000
56+
N = 1000
5757
Ts = 0.01
5858
f0 = 1.0 # Start frequency (Hz)
5959
f1 = 10.0 # End frequency (Hz)
@@ -78,21 +78,12 @@ plot(p1, p2, layout=(2,1), size=(600, 400))
7878
```@example input_signals
7979
using ControlSystemIdentification.FFTW
8080
81-
# Analyze frequency content of the chirp signals
82-
U_log = abs.(fft(u_log))
83-
U_lin = abs.(fft(u_lin))
84-
85-
# Frequency axis (only plot positive frequencies)
86-
freqs = (0:N-1) / (N*Ts)
87-
half_N = N÷2
88-
89-
# Plot frequency domain (first half only, up to Nyquist frequency)
90-
p1 = plot(freqs[2:half_N], U_log[2:half_N], title="Logarithmic Chirp Spectrum",
81+
p1 = welchplot(iddata(u_log, Ts), title="Logarithmic Chirp Spectrum",
9182
xlabel="Frequency (Hz)", ylabel="Magnitude", label="Log chirp",
92-
xscale=:log10, yscale=:log10, linewidth=2)
93-
p2 = plot(freqs[2:half_N], U_lin[2:half_N], title="Linear Chirp Spectrum",
83+
xscale=:log10, yscale=:log10, linewidth=2, ylims=(1e-3, 1e-1))
84+
p2 = welchplot(iddata(u_lin, Ts), title="Linear Chirp Spectrum",
9485
xlabel="Frequency (Hz)", ylabel="Magnitude", label="Linear chirp",
95-
xscale=:log10, yscale=:log10, linewidth=2)
86+
xscale=:log10, yscale=:log10, linewidth=2, ylims=(1e-3, 1e-1))
9687
vline!(p1, [f0, f1], label="", linestyle=:dash, color=:red, alpha=0.7)
9788
vline!(p2, [f0, f1], label="", linestyle=:dash, color=:red, alpha=0.7)
9889

0 commit comments

Comments
 (0)