Skip to content

Latest commit

 

History

History
42 lines (41 loc) · 2.31 KB

overall.md

File metadata and controls

42 lines (41 loc) · 2.31 KB

MATLAB Calculus Cheat Sheet:smile:

Function Name Definition
Symbolic Math
💡 syms Define symbolic variables for algebraic manipulations.
Example: syms x y
💡 solve Solve algebraic equations symbolically.
Example: eqn = x^2 - 4*x + 4 == 0;
sol = solve(eqn, x);
💡 diff Compute derivatives symbolically.
Example: f = x^2 + 2*x + 1;
df = diff(f, x);
💡 int Compute integrals symbolically.
Example: f = x^2 + 2*x + 1;
F = int(f, x);
Numeric Calculations
💡 sum Calculate the sum of elements in an array.
Example: A = [1, 2, 3, 4, 5];
total = sum(A);
💡 prod Calculate the product of elements in an array.
Example: A = [1, 2, 3, 4, 5];
product = prod(A);
💡 mean Compute the mean (average) of data.
Example: data = [75, 80, 85, 90, 95];
avg = mean(data);
💡 std Calculate the standard deviation of data.
Example: data = [75, 80, 85, 90, 95];
deviation = std(data);
Plotting
💡 plot Create 2D plots of data.
Example: x = linspace(0, 2*pi, 100);
y = sin(x);
plot(x, y);
💡 ezplot Create plots of symbolic expressions.
Example: syms x
f = x^2 - 4*x + 4;
ezplot(f);
Linear Algebra
💡 inv Compute the inverse of a matrix.
Example: A = [1, 2; 3, 4];
B = inv(A);
💡 det Calculate the determinant of a matrix.
Example: A = [1, 2; 3, 4];
determinant = det(A);
Numerical Methods
💡 fminunc Find the minimum of a function numerically.
Example: fun = @(x) x^2 - 4*x + 4;
x0 = 0; % Initial guess
xmin = fminunc(fun, x0);
💡 ode45 Solve ordinary differential equations (ODEs).
Example: dydt = @(t, y) -2*y;
[t, y] = ode45(dydt, [0, 5], 1);
Statistics
💡 normpdf Compute the probability density function of a normal distribution.
Example: mu = 0; % Mean
sigma = 1; % Standard deviation
x = -3:0.1:3;
pdf = normpdf(x, mu, sigma);
💡 binopdf Compute the probability mass function of a binomial distribution.
Example: n = 10; % Number of trials
p = 0.5; % Probability of success
k = 0:10;
pmf = binopdf(k, n, p);