Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Mar 27, 2024
1 parent a99dbbf commit fa1d662
Show file tree
Hide file tree
Showing 310 changed files with 117,695 additions and 0 deletions.
Empty file added docs/.nojekyll
Empty file.
1 change: 1 addition & 0 deletions docs/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs.amdc.dev
111 changes: 111 additions & 0 deletions docs/_downloads/84917b9eb780f77899acd99066109fd5/plot_FRF.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
close all
clear all
clc

%% FRF Estimation Example
%
% Given time-domain input/output data collected from a system,
% compute the estimated FRF and plot it.

%% Generate Example Input/Output Data
%
% TODO: replace this section with your own experimental data

% Load data
num = readtable('../exampleData/LOG_Id.txt');
den = readtable('../exampleData/LOG_Vd_star.txt');

num = table2array(num(:,2));
den = table2array(den(:,2));

fs = 20000;
T = 1/fs;

%% Generate FRF Data

% TODO: Appropriately update these settings per your application
lines = 5000;
win = 'rectwin'; % try 'hanning' or 'rectwin'

[freq, mag, phase, coh] = generateFRF(num, den, T, lines, win);

%% What values to put?
%{
The inputs num, den, and T are straight forward and come directly
from the collected data. However, lines and win depend on the application.
The lines input relates to the number of averages the tfestimate()
function uses. This acts to "smooth" the resulting transfer function.
The value depends on the amount of collected data. Reasonable values for
lines: 1e3 to 20e3. If a value too large is used, a MATLAB error will
result from the tfestimate() function. Reduce the number of lines to
resolve the error.
The win input indicates the desired FFT windowing function, see the
MATLAB help documentation for possible values. Typically, for chirp inputs,
the hanning window can be used. For noise injections, the rectwin is often
a better fit.
%}

%% Plot Estimation

% Show coherence plot?
% 1: yes
% 0: no
SHOW_COHERENCE = 1;

figure

if SHOW_COHERENCE == 1
tiledlayout(3,1);
ax1 = nexttile;
ax2 = nexttile;
ax3 = nexttile;
else
tiledlayout(2,1);
ax1 = nexttile;
ax2 = nexttile;
end

markersize = 8;

plot(ax1, freq, mag, '.', 'markersize', markersize);
plot(ax2, freq, phase, '.', 'markersize', markersize);
if SHOW_COHERENCE == 1
plot(ax3, freq, coh, '.', 'markersize', markersize);
end

ylabel(ax1, "Magnitude (-)");
ylabel(ax2, "Phase (deg)");
if SHOW_COHERENCE == 1
ylabel(ax3, "Coherence");
end

if SHOW_COHERENCE == 1
xlabel(ax3, "Frequency (Hz)");
else
xlabel(ax2, "Frequency (Hz)");
end

f1 = 1;
f2 = 0.5 * (1/T) / 2;
xlim(ax1, [f1 f2]);
xlim(ax2, [f1 f2]);

grid(ax1, 'on');
grid(ax2, 'on');

set(ax1, 'xscale', 'log');
set(ax2, 'xscale', 'log');

%ylim(ax1, [0 6]);
%ylim(ax2, [-120 10]);

if SHOW_COHERENCE == 1
xlim(ax3, [f1 f2]);
ylim(ax3, [0 1.1]);
grid(ax3, 'on');
set(ax3, 'xscale', 'log');
end

print(gcf, "-dpng", '-noui', "examplePlot", '-r300');
Binary file not shown.
38 changes: 38 additions & 0 deletions docs/_downloads/b129cfda5580b3aeb7ea87c95cfcabe2/generateFRF.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Function Name: generateFRF
% Purpose: Generalized creation of FRF
% Input:
% num - numerator for FRF
% den - denominator for FRF
% T - Sample time in seconds
% lines - number of lines for the FRF
% winType - window type for FRF
% Output:
% freq - array of analyzed frequencies in Hz
% mag - magnitude of FRF
% phase - phase of FRF in degrees
% coh - coherence of FRF
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Changelog:
% Date % Inits % Reason
% 6/29/2017 % TSS % Created
% 7/4/2017 % TSS % Verified Functionality
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [freq, mag, phase, coh] = generateFRF(num, den, T, lines, win)

fs = 1/T;
overlap = lines/2;
averages = floor(length(num)/(lines-overlap))
windowType = window(win, lines);

[FRF, freq] = tfestimate(den, num, windowType, overlap, lines, fs);
[coh, freq] = mscohere(den, num, windowType, overlap, lines, fs);

FRF = fftshift(FRF);
coh = fftshift(coh);
freq = freq - max(freq)/2;
mag = abs(FRF);
phase = angle(FRF) * 180/pi;

end
Binary file not shown.
Binary file not shown.
Binary file added docs/_images/01-vin-power.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/02-power-leds.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/03-screw-terminals.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/04-host-interface.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/05-gpio.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/06-power-stack.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/07-analog.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/08-encoder.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/AMDS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/DC_hdr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/FRF_Cont_A.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/FRF_Cont_B.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/FRF_RL.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit fa1d662

Please sign in to comment.