Communication through MATLAB is always better than arguing.

Answered

Finding the index in two different arrays where values are closest

Note: Not tested. ix = abs(a(:) - b(:).'); [~, ID] = min(ix(:)); [where_a, where_b] = ind2sub(size(ix), id)

Finding the index in two different arrays where values are closest

Note: Not tested. ix = abs(a(:) - b(:).'); [~, ID] = min(ix(:)); [where_a, where_b] = ind2sub(size(ix), id)

13 hours ago | 0

Answered

Multiplication of 1D and 2D vector to a 3D vector

C = repelem(B, 1, 1, max(A))

Multiplication of 1D and 2D vector to a 3D vector

C = repelem(B, 1, 1, max(A))

13 hours ago | 0

Answered

Multiplication of 1D and 2D vector to a 3D vector

[m, n] = size(B); C = zeros(m, n, numel(A)); for k = 1:numel(A) C(:, :, A(k)) = B; end C

Multiplication of 1D and 2D vector to a 3D vector

[m, n] = size(B); C = zeros(m, n, numel(A)); for k = 1:numel(A) C(:, :, A(k)) = B; end C

13 hours ago | 0

Answered

Multiplication of 1D and 2D vector to a 3D vector

Sigh. Your question says one thing and your example does another thing. Only God know what you want. C = repmat(B, 1, 1, max...

Multiplication of 1D and 2D vector to a 3D vector

Sigh. Your question says one thing and your example does another thing. Only God know what you want. C = repmat(B, 1, 1, max...

13 hours ago | 0

Answered

Multiplication of 1D and 2D vector to a 3D vector

C = reshape(A, 1, 1, []) .* B % use bsxfun() if you’re version is prior to 2016b C = bsxfun(@times, reshape(A, 1, 1, []), B)...

Multiplication of 1D and 2D vector to a 3D vector

C = reshape(A, 1, 1, []) .* B % use bsxfun() if you’re version is prior to 2016b C = bsxfun(@times, reshape(A, 1, 1, []), B)...

13 hours ago | 0

Answered

Integrate an acceleration vector to obtain a velocity vector

Use cumtrapz() doc cumtrapz

Integrate an acceleration vector to obtain a velocity vector

Use cumtrapz() doc cumtrapz

14 hours ago | 0

| accepted

Answered

Imaginary Number Notation/ Formatting Real and Complex Results

The imaginary part might not be exactly zero. vpa(Answer)

Imaginary Number Notation/ Formatting Real and Complex Results

The imaginary part might not be exactly zero. vpa(Answer)

3 days ago | 1

Answered

Find equal value in two cell arrays

Wanted = find(cellfun(@isequal, A, B))

Find equal value in two cell arrays

Wanted = find(cellfun(@isequal, A, B))

3 days ago | 0

| accepted

Answered

Beginning matlab user error, functions

Take that fminsearch() outside of the function doc function % see how to use functions

Beginning matlab user error, functions

Take that fminsearch() outside of the function doc function % see how to use functions

3 days ago | 0

| accepted

Answered

sin() - Subscript indices must either be real positive integers or logicals.

clear sin % since it's a variable

sin() - Subscript indices must either be real positive integers or logicals.

clear sin % since it's a variable

3 days ago | 1

| accepted

Answered

How do I simplify the values of a function?

>> a a = 2 >> b b = 4 >> syms x f(x) = a*b + b*x f(x) = 4*x + 8 >>

How do I simplify the values of a function?

>> a a = 2 >> b b = 4 >> syms x f(x) = a*b + b*x f(x) = 4*x + 8 >>

3 days ago | 0

Answered

2 Scenario Legend Setup

plot(1:5, '-k') hold on plot(6:10, ':y') legend({'Leg 1', 'Leg2'}) %?

2 Scenario Legend Setup

plot(1:5, '-k') hold on plot(6:10, ':y') legend({'Leg 1', 'Leg2'}) %?

4 days ago | 0

Answered

How to write delta in matlab?

<https://www.mathworks.com/help/symbolic/sym.dirac.html>

How to write delta in matlab?

<https://www.mathworks.com/help/symbolic/sym.dirac.html>

6 days ago | 0

Answered

How to get == to help solving equations

You should have the Symbolic Math Toolbox and the license for it to perform the above operation. In order to replicate your mess...

How to get == to help solving equations

You should have the Symbolic Math Toolbox and the license for it to perform the above operation. In order to replicate your mess...

7 days ago | 0

Answered

How to use blkdiag in 3D matrix

A slight variation: M = cell(size(B, 3), 1); for k = 1 : size(A, 3) M{k} = blkdiag(A(:, : , k), B(:, :, k)); end M =...

How to use blkdiag in 3D matrix

A slight variation: M = cell(size(B, 3), 1); for k = 1 : size(A, 3) M{k} = blkdiag(A(:, : , k), B(:, :, k)); end M =...

7 days ago | 0

Answered

How do I add color to text output to the Command Window?

https://www.mathworks.com/matlabcentral/fileexchange/24093-cprintf-display-formatted-colored-text-in-the-command-wind

How do I add color to text output to the Command Window?

https://www.mathworks.com/matlabcentral/fileexchange/24093-cprintf-display-formatted-colored-text-in-the-command-wind

7 days ago | 0

Answered

Need help inputting my equation into MATLAB

In line f, M(t) causes the error perhaps you mean‘t M*t ?

Need help inputting my equation into MATLAB

In line f, M(t) causes the error perhaps you mean‘t M*t ?

7 days ago | 0

Answered

How to store value of for loop in a array

for z = linspace(0, 0.03, 31) By the way you don’t need a Loop it’s simply: A = 1 ./ (1 + ((z / aes) .^ 2))

How to store value of for loop in a array

for z = linspace(0, 0.03, 31) By the way you don’t need a Loop it’s simply: A = 1 ./ (1 + ((z / aes) .^ 2))

8 days ago | 0

Answered

solve first-order ODE

ode = @(t, Y) sin( exp(Y - t/2) - t^2/2 ) ode45(ode, [0 2*pi], 0)

solve first-order ODE

ode = @(t, Y) sin( exp(Y - t/2) - t^2/2 ) ode45(ode, [0 2*pi], 0)

8 days ago | 0

Answered

Creating an array of dependent symbolic variable

A(x) = str2sym(regexprep(char(A), '(\_?\d)+', '$0(x)'))

Creating an array of dependent symbolic variable

A(x) = str2sym(regexprep(char(A), '(\_?\d)+', '$0(x)'))

9 days ago | 0

| accepted

Answered

splitting up numbers in a cell of a double

Wanted = vertcat(cell_array{:}) %or Wanted = cat(1, cell_array{:})

splitting up numbers in a cell of a double

Wanted = vertcat(cell_array{:}) %or Wanted = cat(1, cell_array{:})

9 days ago | 0

Answered

How can I asign columns of a matrix to different matrixes?

permute(reshape(matrix, 154, 558, []), [2, 1, 3])

How can I asign columns of a matrix to different matrixes?

permute(reshape(matrix, 154, 558, []), [2, 1, 3])

9 days ago | 1

| accepted

Answered

substitute only first derivative in symbolic toolbox

I remember doing vibration analysis, used to be pretty tricky: expr2 = subs(expr, diff(x, 2), diff(v))

substitute only first derivative in symbolic toolbox

I remember doing vibration analysis, used to be pretty tricky: expr2 = subs(expr, diff(x, 2), diff(v))

10 days ago | 0

| accepted