"Example 6.X" or "Example 6.XX"."Example 6.X" is the first word of the paragraph."Example 6.X" or "Example 6.XX"."Example 6.X" is the first word of the paragraph.Sub SetFirstColumnWidthInPicas()
Dim tbl As Table
Dim r As Long
Dim desiredWidthPicas As Single
Dim desiredWidthPoints As Single
' Set desired width in picas
desiredWidthPicas = 30 ' ? Change this as needed
desiredWidthPoints = desiredWidthPicas * 12 ' Convert picas to points
For Each tbl In ActiveDocument.Tables
With tbl
For r = 1 To .Rows.Count
On Error Resume Next ' In case cell doesn't exist (e.g. merged)
With .cell(r, 1)
.Width = desiredWidthPoints
End With
On Error GoTo 0
Next r
End With
Next tbl
MsgBox "First column width updated to " & desiredWidthPicas & " picas.", vbInformation
End Sub
Sub ChangeFontInSecondColumn()
Dim tbl As Table
Dim r As Long, c As Long
Dim cell As cell
Dim targetCol As Long
Dim rng As Range
targetCol = 2 ' Second column
For Each tbl In ActiveDocument.Tables
With tbl
For r = 1 To .Rows.Count
On Error Resume Next ' In case cell(2) doesn't exist in a row
Set cell = .cell(r, targetCol)
If Not cell Is Nothing Then
Set rng = cell.Range
rng.End = rng.End - 1 ' Exclude end-of-cell marker
With rng.Font
.Name = "STIX Two Text"
.Size = 10
End With
End If
Set cell = Nothing
Set rng = Nothing
On Error GoTo 0
Next r
End With
Next tbl
MsgBox "Font updated in second column of all tables.", vbInformation
End Sub
Transfer function Laplace (s) untuk low pass filter
G(s) = K/(1+Tc.s)
dimana K adalah gain filter, Tc adalah konstanta waktu filter, s adalah variabel Laplace.
Persamaan beda untuk low pass filter diskrit
x[n+1] = (1-Ts/Tc).x[n] + K.(Ts/Tc).u[n]
y[n] = x[n]
dimana Ts adalah time sampling, Tc adalah konstanta waktu filter (cut-off), K adalah gain filter, dan u[n] adalah sinyal input filter.
fs = 1e3; % Sample frequency (Hz)
t = [0:1/fs:10]; % Time vector
x = 5*sin(2*pi*300.*t)+2*sin(2*pi*100.*t); % Signal
y = fft(x);
n = length(x); % number of samples
f = (0:n-1)*(fs/n); % frequency range
power = abs(y).^2/n; % power of the DFT
plot(f,power)
xlabel('Frequency')
ylabel('Power')
Saat ini saya perlu mengukur lama waktu komputasi untuk membandingkan dua metode.
di MATLAB, cara untuk menampilkan waktu komputasi adalah dengan menambahkan 'tic' dan 'toc' di bagian awal dan akhir algoritma kita.
misalnya, seperti ini:
tic
Z1=kron(A,B);
Z2=kron(Z1,C);
toc
kron adalah operasi Kronecker product dari dua matriks. setelah dijalankan, maka akan tampil
Elapsed time 0.0014325 seconds
Ketika program dijalankan ulang, memang waktunya ndak sama persis, bergantung pada kesibukan prosesor, tapi relatif mirip2. Saya bisa gunakan tic toc ini untuk membandingkan dua metode, mana yang lebih efisien.
referensi: mathworks