Tag: matlab

Linearize nonlinear state space equation in MATLAB at steady state setpoint

This post shows one way to linearize a nonlinear state equation \dot{x} = f(x,u) at a steady state setpoint (x_0, u_0) in MATLAB. It is assumed that a function ode.m exists in which the state equation is implemented:

Read More

Calculate Levenshtein distance in MATLAB (words or characters) with Wagner–Fischer algorithm

  Read More

Convert dSPACE ControlDesk measurements to MATLAB/Simulink timeseries (updated)

(Old version here)

  • With this updated MATLAB script, multiple dSPACE ControlDesk measurements can be imported with a single execution
  • The result is saved as a tscollection (collection of timeseries) and all signals are saved with their corresponding name
  • Access imported data with Simulink ‘From Workspace’ block and, e.g.,  dsp_tscs{1}.my_signal

Read More

Convert dSPACE ControlDesk measurement to MATLAB timeseries that can be used in Simulink

(Updated version here)

  • dSPACE ControlDesk can export measurements to mdf4 files or mat files
  • mat file exports can be converted to timeseries with this MATLAB script
  • The timeseries can then be imported into Simulink with the ‘From Workspace’ blog
  • Multiple signals can be imported at once

Example output:

Read More

Analytical convolution integral (Analytische Faltung) with Matlab and Maple

With \sigma(t) = Heaviside(t) and \delta(t) = Dirac(t)
Function 1 (e.g. input signal/Eingangssignal):
u(t) = \sigma(t-1) - \sigma(t-4)

Function 2 (e.g. impulse response/Stoßantwort):
g(t) = -\frac{1}{RC}\exp(-\frac{t}{RC})\sigma(t) + \delta(t)

Read More