Answered

Error using optimset(@lsqnonlin) matlab 2020b

Wrong options routine for that function. You need https://www.mathworks.com/help/optim/ug/optim.problemdef.optimizationproblem...

Error using optimset(@lsqnonlin) matlab 2020b

Wrong options routine for that function. You need https://www.mathworks.com/help/optim/ug/optim.problemdef.optimizationproblem...

25 minuter ago | 0

Answered

Meaning of "#X" in output of dsolve

I have not seen that output from dsolve() before, but I confirm that it exists. If you focus in, you will see that you have sub...

Meaning of "#X" in output of dsolve

I have not seen that output from dsolve() before, but I confirm that it exists. If you focus in, you will see that you have sub...

ungefär 2 timmar ago | 0

Answered

Solve equation in interval

syms x solve([diff(x^2*exp(-x)), x <= 1, x >= -1])

Solve equation in interval

syms x solve([diff(x^2*exp(-x)), x <= 1, x >= -1])

ungefär 3 timmar ago | 0

Answered

Storing data in matlab matrix using loop

[K1, K2, K3] = ndgrid(2:1:20, 2:1:20, 2:1:20); M = K1 + K2 + K3; mask = M == 20; A = [K1(mask), K2(mask), K3(mask)]; size(A)...

Storing data in matlab matrix using loop

[K1, K2, K3] = ndgrid(2:1:20, 2:1:20, 2:1:20); M = K1 + K2 + K3; mask = M == 20; A = [K1(mask), K2(mask), K3(mask)]; size(A)...

ungefär 3 timmar ago | 0

Answered

Not enough input arguments

You have not shown us the definition of f, g, or j, so we cannot say which of them needs more than the four input arguments you ...

Not enough input arguments

You have not shown us the definition of f, g, or j, so we cannot say which of them needs more than the four input arguments you ...

ungefär 3 timmar ago | 0

Answered

Could someone explain what the code means?

1/1^4 + 1/2^4 + 1/3^4 + 1/4^4 + 1/5^4 + 1/6^4 and keep going adding values until the number stops changing (which will happen be...

Could someone explain what the code means?

1/1^4 + 1/2^4 + 1/3^4 + 1/4^4 + 1/5^4 + 1/6^4 and keep going adding values until the number stops changing (which will happen be...

ungefär 5 timmar ago | 0

Answered

How to replace all newline characters in a string with a space?

strfind(strtxt, 10) will return the indices. Hint: S = "hello" S{1}(1) = 'j'

How to replace all newline characters in a string with a space?

strfind(strtxt, 10) will return the indices. Hint: S = "hello" S{1}(1) = 'j'

ungefär 5 timmar ago | 0

Answered

MATLAB DOES NOT CALCULATE THE ABSOLUTE VALUE

To get anywhere useful in a few lines, we have to make the unjustified assumption that the variable i corresponds to sqrt(-1) ...

MATLAB DOES NOT CALCULATE THE ABSOLUTE VALUE

To get anywhere useful in a few lines, we have to make the unjustified assumption that the variable i corresponds to sqrt(-1) ...

ungefär 5 timmar ago | 0

Answered

Index exceeds the number of array elements error

Suppose MaxPayload was 250, 0:100:250 is 0 100 200. All of the entries of that are less than MaxPayload so the loop would not te...

Index exceeds the number of array elements error

Suppose MaxPayload was 250, 0:100:250 is 0 100 200. All of the entries of that are less than MaxPayload so the loop would not te...

ungefär 8 timmar ago | 0

Answered

how to use if comparison

The code is working properly according to the requirements that you stated. You want it to change the value to 0 if the conditio...

how to use if comparison

The code is working properly according to the requirements that you stated. You want it to change the value to 0 if the conditio...

ungefär 10 timmar ago | 0

Answered

Checking if a value is equal to zero or no ? with the problem of floating-point numbers !

sum(A) - 1 ans = -1.11022302462516e-16 MATLAB uses ieee 754 binary double precision representation, which is ...

Checking if a value is equal to zero or no ? with the problem of floating-point numbers !

sum(A) - 1 ans = -1.11022302462516e-16 MATLAB uses ieee 754 binary double precision representation, which is ...

ungefär 10 timmar ago | 0

Answered

plot filled rectangle and appear on legend

Use fill() such as fill([xmin xmax xmax xmin], [ymin ymin ymax ymax], 'facecolor', 'y')

plot filled rectangle and appear on legend

Use fill() such as fill([xmin xmax xmax xmin], [ymin ymin ymax ymax], 'facecolor', 'y')

ungefär 16 timmar ago | 0

| accepted

Answered

What is the difference between Double 1.0000 and Double 1 ?

A=1; B=1.000; if (A==B) "True" else "false" end When you see something displaying as 1 with no decimal points, then...

What is the difference between Double 1.0000 and Double 1 ?

A=1; B=1.000; if (A==B) "True" else "false" end When you see something displaying as 1 with no decimal points, then...

ungefär 16 timmar ago | 0

Answered

Matrix element changes according to reference

Y=[ 11 12 13; 21 22 23; 31 32 33]; A=[1 1; 2 3; 3 2]; Y(A(:,2), A(:,2))

Matrix element changes according to reference

Y=[ 11 12 13; 21 22 23; 31 32 33]; A=[1 1; 2 3; 3 2]; Y(A(:,2), A(:,2))

ungefär 16 timmar ago | 0

Answered

how to use "getframe" commander for making animation video.

Each time the XLim or YLim changes, MATLAB recalculates the exact size of the inner window. Sometimes, possibly due to round-off...

how to use "getframe" commander for making animation video.

Each time the XLim or YLim changes, MATLAB recalculates the exact size of the inner window. Sometimes, possibly due to round-off...

ungefär 17 timmar ago | 0

Answered

fmincon and fmiunc gives different result for the same problem

This is expected. fmincon() and fminunc() use different algorithms. You might possibly be able to get somewhere by forcing fmin...

fmincon and fmiunc gives different result for the same problem

This is expected. fmincon() and fminunc() use different algorithms. You might possibly be able to get somewhere by forcing fmin...

ungefär 23 timmar ago | 0

| accepted

Answered

Cant convert more than 80 columns of data to categorical

When you categorical() numeric values, then internally it uses %-0.5g format to convert the values to character vectors. It then...

Cant convert more than 80 columns of data to categorical

When you categorical() numeric values, then internally it uses %-0.5g format to convert the values to character vectors. It then...

ungefär 23 timmar ago | 0

| accepted

Answered

How to extract audio from mp4 video file with Matlab?

https://www.mathworks.com/help/vision/ref/vision.videofilereader-system-object.html or use audioread without 'native' https:/...

How to extract audio from mp4 video file with Matlab?

https://www.mathworks.com/help/vision/ref/vision.videofilereader-system-object.html or use audioread without 'native' https:/...

ungefär 23 timmar ago | 0

Answered

For loop inside for loop

The first group of values goes into columns 1 to 8. Call that group number 1, and associated indices 1 to 8. The second group o...

For loop inside for loop

The first group of values goes into columns 1 to 8. Call that group number 1, and associated indices 1 to 8. The second group o...

ungefär 23 timmar ago | 1

Answered

MATLAB code for ORPD by genetic algorithm

Modify https://www.mathworks.com/matlabcentral/fileexchange/41265-optimal-reactive-power-dispatch-orpd-using-particle-swarm-opti...

MATLAB code for ORPD by genetic algorithm

Modify https://www.mathworks.com/matlabcentral/fileexchange/41265-optimal-reactive-power-dispatch-orpd-using-particle-swarm-opti...

ungefär 24 timmar ago | 0

Answered

wrong dimensions on a 3D array

%the below needs R2020b or later re_arranged = permute(Matrix, [2 3 1]); filtered = pagetimes(re_arranged, filter_matrix); Th...

wrong dimensions on a 3D array

%the below needs R2020b or later re_arranged = permute(Matrix, [2 3 1]); filtered = pagetimes(re_arranged, filter_matrix); Th...

ungefär 24 timmar ago | 0

Answered

changing the name of the csv files but getting errors

folder = fullfile('C:','Users','muhammad','Desktop','Velocity'); files = dir( fullfile(folder, '*.csv') ); % Loop through each...

changing the name of the csv files but getting errors

folder = fullfile('C:','Users','muhammad','Desktop','Velocity'); files = dir( fullfile(folder, '*.csv') ); % Loop through each...

ungefär 24 timmar ago | 1

| accepted

Answered

error using plot, vectors must be the same length

FV = fft(fv); %Fourier Transform of filtered signal That's a vector. FVabs = (0:abs(FV)/2); That is using t...

error using plot, vectors must be the same length

FV = fft(fv); %Fourier Transform of filtered signal That's a vector. FVabs = (0:abs(FV)/2); That is using t...

ungefär 24 timmar ago | 0

| accepted

Answered

Complex Numbers in Matrices

format short %create some data that has the required characteristics N = complex(rand(4,60), rand(4,60)); for K = 1 : 60; c =...

Complex Numbers in Matrices

format short %create some data that has the required characteristics N = complex(rand(4,60), rand(4,60)); for K = 1 : 60; c =...

en dag ago | 0

Answered

Help With Conditonally variant Anonymous function.

B_2 = @(z) ((z>=z(501)&z<=z(1500)) * 2 - 1) .* val The logical test that is satisfied by the range will return true (1) in the ...

Help With Conditonally variant Anonymous function.

B_2 = @(z) ((z>=z(501)&z<=z(1500)) * 2 - 1) .* val The logical test that is satisfied by the range will return true (1) in the ...

en dag ago | 0

Answered

Saving categorical using For loop

PosData = FilledTtrnPos(:,2:171); for i = 170 : -1 : 1 clsTraits(:,i) = categorical(PosData{:,i}); end Note that I did n...

Saving categorical using For loop

PosData = FilledTtrnPos(:,2:171); for i = 170 : -1 : 1 clsTraits(:,i) = categorical(PosData{:,i}); end Note that I did n...

en dag ago | 0

Answered

How do you add up data in a for loop to plot in a histogram?

sum_zm = sum(cat(3, zfm{:}),3); surf(Zf_vals, Df_vals, sum_zm, 'edgecolor', 'none'); This is not the best way: the best way is...

How do you add up data in a for loop to plot in a histogram?

sum_zm = sum(cat(3, zfm{:}),3); surf(Zf_vals, Df_vals, sum_zm, 'edgecolor', 'none'); This is not the best way: the best way is...

en dag ago | 0

Answered

Subtracting mean from table column and creating new Column with solution

t.NewColumn = mean(t{:,10}) - t{:,5};

Subtracting mean from table column and creating new Column with solution

t.NewColumn = mean(t{:,10}) - t{:,5};

en dag ago | 0

Answered

How to define the variables of a function handle before the function

B=0.02818; L=0.00098; h=1; t_max=5; t_span = (0:h:t_max); S_0=2782000 I_0=1; R_0=0; y0 = [S_0;I_0;R_0]; N = S_0+I_0+R...

How to define the variables of a function handle before the function

B=0.02818; L=0.00098; h=1; t_max=5; t_span = (0:h:t_max); S_0=2782000 I_0=1; R_0=0; y0 = [S_0;I_0;R_0]; N = S_0+I_0+R...

en dag ago | 0

Answered

How do I name figures in for loops.

for i = 1 : 2 fig(i) = figure('name', sprintf('location %d', i)); end fig(1).Name fig(2).Name

How do I name figures in for loops.

for i = 1 : 2 fig(i) = figure('name', sprintf('location %d', i)); end fig(1).Name fig(2).Name

en dag ago | 1