Answered

Error in function handle using fminsearch

min3 = fminsearch(f, x0);

Error in function handle using fminsearch

min3 = fminsearch(f, x0);

casi 2 años ago | 0

| accepted

Answered

Make a vector based on for loop values

You are close: if (mod(n,2) == 1)&& (mod(n,11) == 0 || mod(n,13) == 0); If the above statement is true , you will save n ...

Make a vector based on for loop values

You are close: if (mod(n,2) == 1)&& (mod(n,11) == 0 || mod(n,13) == 0); If the above statement is true , you will save n ...

casi 2 años ago | 0

| accepted

Answered

Error in ODE45

MATLAB doesn't have implicit multiplication, hence: dT1 = (F1*(Tc-T1)+Fr*(T2-T1)+(Q1/rho_w*Cp))/(A2*h2); Note: Fr is not ...

Error in ODE45

MATLAB doesn't have implicit multiplication, hence: dT1 = (F1*(Tc-T1)+Fr*(T2-T1)+(Q1/rho_w*Cp))/(A2*h2); Note: Fr is not ...

casi 2 años ago | 0

| accepted

Answered

Repeat value/variable in one column based on variable in another column

c = {'CS1' '7' '7' '7' '7' 'CS2' '9' '9' '9' ... 'CS1' '7' '9' '7' '7' '7' '7' '7' 'CS1'}; ix = ~isnan(str2double(c)); ...

Repeat value/variable in one column based on variable in another column

c = {'CS1' '7' '7' '7' '7' 'CS2' '9' '9' '9' ... 'CS1' '7' '9' '7' '7' '7' '7' '7' 'CS1'}; ix = ~isnan(str2double(c)); ...

casi 2 años ago | 0

| accepted

Answered

Matrix with for cycle

Qbar = cell(N, 1); % preallocate properly for other variables also Qbar{ii} = ... inside loop

Matrix with for cycle

Qbar = cell(N, 1); % preallocate properly for other variables also Qbar{ii} = ... inside loop

casi 2 años ago | 0

| accepted

Answered

How do I get the differential of Hermite polynomial function?

https://www.mathworks.com/matlabcentral/answers/606286-how-do-i-get-the-differential-of-hermite-polynomial-function#comment_1039...

How do I get the differential of Hermite polynomial function?

https://www.mathworks.com/matlabcentral/answers/606286-how-do-i-get-the-differential-of-hermite-polynomial-function#comment_1039...

casi 2 años ago | 0

Answered

Matlab array and matrices

<https://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html> Start with MATLAB On-ramp course.

Matlab array and matrices

<https://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html> Start with MATLAB On-ramp course.

casi 2 años ago | 0

Answered

Convert for loop to while loop

Initialise ii with 0 instead of 1. Otherwise you start it as 2 therefore when you reach 5 it gets incremented to 6 exceeding the...

Convert for loop to while loop

Initialise ii with 0 instead of 1. Otherwise you start it as 2 therefore when you reach 5 it gets incremented to 6 exceeding the...

casi 2 años ago | 0

Answered

How to remove the swap vectors from a matrix?

[Original_matrix, c, ~] = unique(sort(matrix, 2), 'rows'); New_matrix = matrix(setdiff(1:size(matrix, 1), c), :)

How to remove the swap vectors from a matrix?

[Original_matrix, c, ~] = unique(sort(matrix, 2), 'rows'); New_matrix = matrix(setdiff(1:size(matrix, 1), c), :)

casi 2 años ago | 0

Answered

Efficient way/best practice to slice array under a logical condition as well as other conditions

What you have is more efficient.

Efficient way/best practice to slice array under a logical condition as well as other conditions

What you have is more efficient.

casi 2 años ago | 0

Answered

How to store functions in matrix or some way to define them by iterations?

x = 0 : .01: 1; u = x.^2 + 6*x - 7;

How to store functions in matrix or some way to define them by iterations?

x = 0 : .01: 1; u = x.^2 + 6*x - 7;

casi 2 años ago | 1

| accepted

Answered

How to check if a column data is equal to any of a group of values?

clear sum Ind = sum(ismember(A, B), 2) %Or perhaps you need Ind = nnz(ismember(A, B)) %or fprintf('%d occurs %d times/s\n',...

How to check if a column data is equal to any of a group of values?

clear sum Ind = sum(ismember(A, B), 2) %Or perhaps you need Ind = nnz(ismember(A, B)) %or fprintf('%d occurs %d times/s\n',...

casi 2 años ago | 0

Answered

Variable indexing for loop when vector is negative (Array indices must be positive integers or logical values)

a = @(x) 12 * x.^5; a(x)

Variable indexing for loop when vector is negative (Array indices must be positive integers or logical values)

a = @(x) 12 * x.^5; a(x)

casi 2 años ago | 0

Answered

How to remove rows based on logical values in one column?

T = table2array(readtable('73(4)_interval.xlsx')); T(any(T==0, 2), : ) = []

How to remove rows based on logical values in one column?

T = table2array(readtable('73(4)_interval.xlsx')); T(any(T==0, 2), : ) = []

casi 2 años ago | 0

Answered

How to do sum of array having decimal value?

clear sum h = [ 0.2 0.54 0.75 1.33 ]; sum(h(2 : end))

How to do sum of array having decimal value?

clear sum h = [ 0.2 0.54 0.75 1.33 ]; sum(h(2 : end))

casi 2 años ago | 0

Answered

3d function domain problem

https://www.mathworks.com/help/matlab/ref/ellipsoid.html

3d function domain problem

https://www.mathworks.com/help/matlab/ref/ellipsoid.html

casi 2 años ago | 0

Answered

Accessing Table entries in MATLAB

https://www.mathworks.com/help/matlab/matlab_prog/access-data-in-a-table.html

Accessing Table entries in MATLAB

https://www.mathworks.com/help/matlab/matlab_prog/access-data-in-a-table.html

casi 2 años ago | 0

Answered

Reshape and Modify a cell array

Bessere Version: V = reshape(Ubertragungsmatrix(:, end), [], 3, 2); V1 = squeeze(num2cell(V, [1, 2])); [Pu_tr, Pn_tr] = deal(...

Reshape and Modify a cell array

Bessere Version: V = reshape(Ubertragungsmatrix(:, end), [], 3, 2); V1 = squeeze(num2cell(V, [1, 2])); [Pu_tr, Pn_tr] = deal(...

casi 2 años ago | 0

Answered

Reshape and Modify a cell array

Vielleicht? C = num2cell(reshape(Ubertragungsmatrix(:, end), 294/2, []), 1); C1 = num2cell(cellfun(@(x) {reshape(x, [], 3)}, C...

Reshape and Modify a cell array

Vielleicht? C = num2cell(reshape(Ubertragungsmatrix(:, end), 294/2, []), 1); C1 = num2cell(cellfun(@(x) {reshape(x, [], 3)}, C...

casi 2 años ago | 0

| accepted

Answered

Use subscript and superscript in legend

legend(['$\overline{H}_{subscript}^' ... '{superscript}$'],... 'interpreter','latex')

Use subscript and superscript in legend

legend(['$\overline{H}_{subscript}^' ... '{superscript}$'],... 'interpreter','latex')

casi 2 años ago | 0

| accepted

Answered

What Dth stands for?

Dth stands for the row 2 , index it to the matrix and use sum().

What Dth stands for?

Dth stands for the row 2 , index it to the matrix and use sum().

casi 2 años ago | 0

Answered

How to select specific string

Wanted = cell_array(contains(cell_array, "197701011"))

How to select specific string

Wanted = cell_array(contains(cell_array, "197701011"))

casi 2 años ago | 0

Answered

Replacing n random zeros in a matrix with a specific nonzero value

X(randperm(numel(X), 10)) = 1

Replacing n random zeros in a matrix with a specific nonzero value

X(randperm(numel(X), 10)) = 1

casi 2 años ago | 0

| accepted

Answered

How to calculate new column values by using present_value and present_value -1?

v(2:end) ./ v(1:end-1) I would suggest you to do MATLAB On-ramp Course.

How to calculate new column values by using present_value and present_value -1?

v(2:end) ./ v(1:end-1) I would suggest you to do MATLAB On-ramp Course.

casi 2 años ago | 0

Answered

Issue fprint outputting an xyz matrix to a file

fid = fopen('test.txt' , 'w'); fprintf(fid, 'Create vertex x %.2f y %.2f z %.2f\n',data.') fclose(fid) Why not simply ...

Issue fprint outputting an xyz matrix to a file

fid = fopen('test.txt' , 'w'); fprintf(fid, 'Create vertex x %.2f y %.2f z %.2f\n',data.') fclose(fid) Why not simply ...

casi 2 años ago | 0

| accepted

Answered

Why am I getting invalid expression?

h = 34.869 ; c = 13.679 ; J2eV = 0.845 ; lambda = 800:6:854; E = ((h * c) ./ lambda) / J2eV ; compose("Energy in eV: %f", E...

Why am I getting invalid expression?

h = 34.869 ; c = 13.679 ; J2eV = 0.845 ; lambda = 800:6:854; E = ((h * c) ./ lambda) / J2eV ; compose("Energy in eV: %f", E...

casi 2 años ago | 1

Answered

Why am I getting the error of "Array indices must be positive integers or logical values." in the f(x) line?

Why on Earth do you need a loop? x = -1.612 : 0.01 : -1.322 ; f = 8 * x.^3 - 2 * x.^2 - 15 * x + 11 ; g = -10 * x.^3 + 10 * x...

Why am I getting the error of "Array indices must be positive integers or logical values." in the f(x) line?

Why on Earth do you need a loop? x = -1.612 : 0.01 : -1.322 ; f = 8 * x.^3 - 2 * x.^2 - 15 * x + 11 ; g = -10 * x.^3 + 10 * x...

casi 2 años ago | 0

| accepted

Answered

Ordinary Differential Equations using laplace transform and plotting

fplot(sol)

Ordinary Differential Equations using laplace transform and plotting

fplot(sol)

casi 2 años ago | 0

Answered

Double integral with limits

f = @(y, x) exp(2*x).*(cos(y)); % order of integration was wrong g1= @(y) sin(y); q = integral2(f,0,pi,0,g1) % Using Symbo...

Double integral with limits

f = @(y, x) exp(2*x).*(cos(y)); % order of integration was wrong g1= @(y) sin(y); q = integral2(f,0,pi,0,g1) % Using Symbo...

casi 2 años ago | 1