2024-08-01 01:42:56 +08:00
|
|
|
---
|
|
|
|
title: Useful Mathematica functions for signal processing units
|
|
|
|
author: peter
|
|
|
|
date: 2024-08-01 01:40:23 +0800
|
|
|
|
categories: [Uni] # Blogging | Electronics | Programming | Mechanical | SelfHosting
|
|
|
|
tags: [ELEC4402] # systems | embedded | rf | microwave | electronics | solidworks | automation | tip
|
|
|
|
# image: assets/img/2024-08-01-Useful-Mathematica-f/preview.png
|
|
|
|
---
|
|
|
|
|
|
|
|
I will update this as I add more functions.
|
|
|
|
|
|
|
|
Using it for the unit ELEC4402 Communication Systems
|
|
|
|
|
|
|
|
```mathematica
|
|
|
|
(* Signal power *)
|
|
|
|
SigPower[expr_, t_] :=
|
2024-08-14 15:54:38 +08:00
|
|
|
Limit[1/(2 T) Integrate[expr^2, {t, -T, T}], T -> Infinity]
|
2024-08-01 01:42:56 +08:00
|
|
|
|
2024-08-14 15:54:38 +08:00
|
|
|
(* Normalized sinc function,default Sinc in Mathematica is not \
|
|
|
|
normalized *)
|
2024-08-01 01:42:56 +08:00
|
|
|
SincNorm[Infinity] := Sinc[Pi Infinity]
|
|
|
|
SincNorm[t_?NumericQ] := Sinc[Pi t]
|
|
|
|
|
2024-08-14 15:54:38 +08:00
|
|
|
(* Fourier transform,frequency in Hz *)
|
2024-08-01 01:42:56 +08:00
|
|
|
FTfreq[varargs__] :=
|
|
|
|
FourierTransform[varargs,
|
|
|
|
FourierParameters -> {0, -2*Pi}] /. {Sinc[f_] :>
|
|
|
|
SincNorm[Simplify[f/Pi]]}
|
|
|
|
|
2024-08-14 15:54:38 +08:00
|
|
|
(* Inverse Fourier transform,frequency in Hz *)
|
2024-08-01 01:42:56 +08:00
|
|
|
IFTfreq[varargs__] :=
|
|
|
|
InverseFourierTransform[varargs,
|
|
|
|
FourierParameters -> {0, -2*Pi}] /. {Sinc[f_] :>
|
|
|
|
SincNorm[Simplify[f/Pi]]}
|
|
|
|
```
|