Answered

vpasolve gives me only 1 x-value of intersection

vpasolve() only ever returns multiple results in the case of where the expressions are all polynomials, and there is the same nu...

vpasolve gives me only 1 x-value of intersection

vpasolve() only ever returns multiple results in the case of where the expressions are all polynomials, and there is the same nu...

4 days ago | 0

Answered

Why won't the tf command work for my function?

tf() can never accept symbolic values. Also the arrays you constructed included s to powers, but tf expects just vectors of num...

Why won't the tf command work for my function?

tf() can never accept symbolic values. Also the arrays you constructed included s to powers, but tf expects just vectors of num...

4 days ago | 1

Answered

How to use error handler for arrayfun?

logicalOutput = arrayfun(@(id) passingCentralZone(id), input_data.id(1:10), 'ErrorHandler', @(s,varargin) false());

How to use error handler for arrayfun?

logicalOutput = arrayfun(@(id) passingCentralZone(id), input_data.id(1:10), 'ErrorHandler', @(s,varargin) false());

4 days ago | 0

| accepted

Answered

Error: Too many functions when plotting series

x=[0:pi/100:2*pi]; That creates a numeric x in steps of syms f(x); That is equivalent to syms x f = symfun('f(x)', x) wh...

Error: Too many functions when plotting series

x=[0:pi/100:2*pi]; That creates a numeric x in steps of syms f(x); That is equivalent to syms x f = symfun('f(x)', x) wh...

4 days ago | 1

| accepted

Answered

How to write this expression in matlab?

syms k n r expr = nchoosek(n, k) * (n-k)/sqrt(n) * (-1)^(n-k) * sinh(r)^(2*n-1-2*k) * cosh(r)^(2*k-n-1) g(n) = symsum(expr, k,...

How to write this expression in matlab?

syms k n r expr = nchoosek(n, k) * (n-k)/sqrt(n) * (-1)^(n-k) * sinh(r)^(2*n-1-2*k) * cosh(r)^(2*k-n-1) g(n) = symsum(expr, k,...

4 days ago | 0

| accepted

Answered

How to find which equation that have "Warning: Solution does not exist because the system is inconsistent"

If you get inf on output, there are few possibilities: that there are infinite entries in the matrix (but these would typically...

How to find which equation that have "Warning: Solution does not exist because the system is inconsistent"

If you get inf on output, there are few possibilities: that there are infinite entries in the matrix (but these would typically...

4 days ago | 0

Answered

I'm a newbie coding titanic but got stuck with an error

Titanic_test = readtable('test.csv'); That returns a table object. age_test = cell2mat(Titanic_test(:,5)); Using () indexing ...

I'm a newbie coding titanic but got stuck with an error

Titanic_test = readtable('test.csv'); That returns a table object. age_test = cell2mat(Titanic_test(:,5)); Using () indexing ...

4 days ago | 0

| accepted

Answered

Record and save audio with your specific file name for the audio.

To allow the user to create the file name use uiputfile [filename, pathname] = uiputfile('*.wav', 'File name for output'); if ...

Record and save audio with your specific file name for the audio.

To allow the user to create the file name use uiputfile [filename, pathname] = uiputfile('*.wav', 'File name for output'); if ...

4 days ago | 0

Answered

Unable to run code analysis

Your file is named 3d_model.mlx . However, the file names for MATLAB source code ( .m ) and Live Script ( .mlx ) and Simulink mo...

Unable to run code analysis

Your file is named 3d_model.mlx . However, the file names for MATLAB source code ( .m ) and Live Script ( .mlx ) and Simulink mo...

4 days ago | 0

| accepted

Answered

Read vtk files (created from paraview) into Matlab

See https://www.mathworks.com/matlabcentral/fileexchange/106610-vtk-read-and-write-package or https://www.mathworks.com/matlabce...

Read vtk files (created from paraview) into Matlab

See https://www.mathworks.com/matlabcentral/fileexchange/106610-vtk-read-and-write-package or https://www.mathworks.com/matlabce...

4 days ago | 0

| accepted

Answered

Why is the fit() function producing a horizontal line above my data?

Activate the "center and scale" option -- but remember that the coefficients you are shown as a result refer to the centered/sca...

Why is the fit() function producing a horizontal line above my data?

Activate the "center and scale" option -- but remember that the coefficients you are shown as a result refer to the centered/sca...

4 days ago | 0

| accepted

Answered

Multiple Outputs for RK methods

Indistinguishable results on the scale of h that I experimented with h = 0.002:0.001:0.007; num_h = length(h); tfinal = 55;...

Multiple Outputs for RK methods

Indistinguishable results on the scale of h that I experimented with h = 0.002:0.001:0.007; num_h = length(h); tfinal = 55;...

4 days ago | 0

Answered

ode45 problem: Index in position 1 is invalid

b = deval(ode45(@(t,y) b(t,y,alfa,sigma),[T 0], 0), flip(maturities)); Before that line, b refers to the function b(t,y,alfa,si...

ode45 problem: Index in position 1 is invalid

b = deval(ode45(@(t,y) b(t,y,alfa,sigma),[T 0], 0), flip(maturities)); Before that line, b refers to the function b(t,y,alfa,si...

4 days ago | 0

Answered

Fzero Initial value issues

fun = @(x) polyval(polyfit(t2,h2,1),x)-.5 Why are you redoing the polyfit each time? You are not changing t2 or h2 or 1 inside ...

Fzero Initial value issues

fun = @(x) polyval(polyfit(t2,h2,1),x)-.5 Why are you redoing the polyfit each time? You are not changing t2 or h2 or 1 inside ...

4 days ago | 0

Answered

How to run matlab on GPU

MATLAB itself cannot run on the GPU. If you have an appropriate GPU, and you have the Parallel Computing Toolbox, then MATLAB ...

How to run matlab on GPU

MATLAB itself cannot run on the GPU. If you have an appropriate GPU, and you have the Parallel Computing Toolbox, then MATLAB ...

4 days ago | 1

| accepted

Answered

using less than operator and combination of if and for statement

You cannot use a condition in for : if you need to use a condition you should be using while Note that when you use while, at l...

using less than operator and combination of if and for statement

You cannot use a condition in for : if you need to use a condition you should be using while Note that when you use while, at l...

4 days ago | 0

| accepted

Answered

I have a battle ship code but I cant get the ships to be placed

During initialization, keep a logical array occupied that starts out all false. For each piece to be placed, randomly generate...

I have a battle ship code but I cant get the ships to be placed

During initialization, keep a logical array occupied that starts out all false. For each piece to be placed, randomly generate...

4 days ago | 0

Answered

Using 'for loop' to plot

Of course you can do it with a loop. I am not clear as to why you are constructing an x range that is not just the inside of th...

Using 'for loop' to plot

Of course you can do it with a loop. I am not clear as to why you are constructing an x range that is not just the inside of th...

4 days ago | 0

Answered

'trainingOptions' without 'trainNetwork' in deep learning

No. trainNetwork knows to use the options because you pass the options in. sgdmupdate does not permit you to pass in options so ...

'trainingOptions' without 'trainNetwork' in deep learning

No. trainNetwork knows to use the options because you pass the options in. sgdmupdate does not permit you to pass in options so ...

5 days ago | 0

| accepted

Answered

Count number of unique symbols in an expression

With limits, present = cellfun(@(expr), ismember(dimen, symvar(expr)), param, 'UniformOutput', false) counts = sum(vertc...

Count number of unique symbols in an expression

With limits, present = cellfun(@(expr), ismember(dimen, symvar(expr)), param, 'UniformOutput', false) counts = sum(vertc...

5 days ago | 0

Answered

How can I change all numbers in matrix to 1? except for 0

logical(inputMatrix) However this will fail if the input includes nan

How can I change all numbers in matrix to 1? except for 0

logical(inputMatrix) However this will fail if the input includes nan

5 days ago | 0

Answered

how to access local files in MATLAB mobile?

Inside MATLAB Mobile, the upper left corner has three main horizontal lines on top of each other. Click on that. In the menu tha...

how to access local files in MATLAB mobile?

Inside MATLAB Mobile, the upper left corner has three main horizontal lines on top of each other. Click on that. In the menu tha...

5 days ago | 0

Answered

Convert function handle to a function in ODE45

Do not do that. Instead use A = [1 2 3; 1 3 4; 7 6 5]; Jnew = matlabFunction(A*y(:) + J*y(:), 'vars', {y(:)}); ...

Convert function handle to a function in ODE45

Do not do that. Instead use A = [1 2 3; 1 3 4; 7 6 5]; Jnew = matlabFunction(A*y(:) + J*y(:), 'vars', {y(:)}); ...

5 days ago | 0

Answered

Could anyone tell me why I am getting an error with "else" in my code. This is my first time using this software and I am very confused.

That code is not MATLAB code. MATLAB codes not use "endif" or "endwhile" or "end else". Also, MATLAB uses == for the comparison ...

Could anyone tell me why I am getting an error with "else" in my code. This is my first time using this software and I am very confused.

That code is not MATLAB code. MATLAB codes not use "endif" or "endwhile" or "end else". Also, MATLAB uses == for the comparison ...

5 days ago | 0

Answered

Hi, how should I display the name for image. Only Name without the pathways.

[~, imgName, extension] = fileparts(InfoImage.Filename); Then use either imgName alone or [imgName, extension] if you want to p...

Hi, how should I display the name for image. Only Name without the pathways.

[~, imgName, extension] = fileparts(InfoImage.Filename); Then use either imgName alone or [imgName, extension] if you want to p...

5 days ago | 0

| accepted

Answered

residue number system in MATLAB

MATLAB can be used to program any deterministic calculation that can fit into your computer memory. MATLAB is Turing-complete: y...

residue number system in MATLAB

MATLAB can be used to program any deterministic calculation that can fit into your computer memory. MATLAB is Turing-complete: y...

5 days ago | 0

| accepted

Answered

why fft of an even and real signal in time domain gives imaginary part?

t = linspace(tmin,tmax,N+1); t(end) = [] ; Your signal must not return to origin in the final sample. You need a signal ...

why fft of an even and real signal in time domain gives imaginary part?

t = linspace(tmin,tmax,N+1); t(end) = [] ; Your signal must not return to origin in the final sample. You need a signal ...

5 days ago | 0

| accepted

Answered

Why am I only receiving one value for theta3 and alpha3, do I need to use a "for" loop instead?

/ is not the division operator in MATLAB. A/B is like inner product of A and the pseudoinverse of B. It is for solving systems o...

Why am I only receiving one value for theta3 and alpha3, do I need to use a "for" loop instead?

/ is not the division operator in MATLAB. A/B is like inner product of A and the pseudoinverse of B. It is for solving systems o...

5 days ago | 1

Answered

While I am running this code I get this error, could anyone knows how to solve it ? (Unable to perform assignment because the size of the left side is 1-by-41 and the size of)

b_vec=zeros(i_max,1); That is a column vector b_vec(1,1)=40; b_vec(ny,1)=10; for i = 2:i_max-1 fo...

While I am running this code I get this error, could anyone knows how to solve it ? (Unable to perform assignment because the size of the left side is 1-by-41 and the size of)

b_vec=zeros(i_max,1); That is a column vector b_vec(1,1)=40; b_vec(ny,1)=10; for i = 2:i_max-1 fo...

5 days ago | 0

Answered

the error of 'Matlab can only run a file with a valid name'

You have used the green Run button to try to execute code that is stored in a file that is not named like a valid MATLAB identif...

the error of 'Matlab can only run a file with a valid name'

You have used the green Run button to try to execute code that is stored in a file that is not named like a valid MATLAB identif...

6 days ago | 2