Commit 32a69b36 by Aaron Erhardt

### Final update for Matlab cheatsheet

```
Signed-off-by: Aaron Erhardt <aaron.erhardt@t-online.de>```
parent 1313c56c
Pipeline #756 passed with stage
in 1 minute and 59 seconds
 ... ... @@ -126,6 +126,13 @@ diag(flip(A)) % other diagonal (bottom left to top right) x = A \ b % solves Ax = b ``` ## Find indices ```matlab i = find(A); % find all nonzero elements i = find(A > 1); i = find(A < 1, 5); % get the first five elements ``` # Images ... ... @@ -134,14 +141,14 @@ x = A \ b % solves Ax = b ```matlab img = imread('path_to_file') ``` ### Show image ### Show image ```matlab imagesc(img) ``` Color map ### Color map ```matlab colormap(gray()) % gray color map ... ... @@ -283,6 +290,7 @@ fprintf(1, 'value: %d\n', 2) ```matlab save file_name save file_name a b c % only save a, b and c load file_name ``` ... ... @@ -309,6 +317,12 @@ fclose(file_handle) # Polynomials ## Create polynomial from roots ```matlab p = poly([1 -2 3]); ``` ## Fit polynomial to points ```matlab ... ... @@ -323,6 +337,17 @@ p = polyfit(x, y, deg); y = polyval(p, x); ``` ## Multiply polynomials ```matlab p3 = conv(p1, p2); ``` ## Get roots ```matlab r = roots(p); ``` # Graphics ... ... @@ -689,12 +714,39 @@ opts = odeset('absTol', 0.05); % set absolute error tolerance [t y] = ode45(@pendfun, tspan, yNull, opts); ``` ### Other solving algorithms # Transfer functions ## Create ```matlab G = tf([1 0], [2 0 0]); ``` ## Step response information ```matlab S = stepinfo(G); ``` ## Plot step response ```matlab orstep(G); step(G, 0.2); ``` ## Plot bode diagram ```matlab ode23s % bode(G); ``` ## Plot nyquist diagram ```matlab nyquist(G); ``` # Control structures ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment