Answered

How to formulate the random matrix between real interval?

See the second example in the rand doc here, and use your endpoints of 0.10 and 0.50 instead of the example endpoints of -5 and ...

How to formulate the random matrix between real interval?

See the second example in the rand doc here, and use your endpoints of 0.10 and 0.50 instead of the example endpoints of -5 and ...

ungefär en månad ago | 0

| accepted

Answered

Complex matrix inversion using LAPACK in MEX

I took your code and modified it to be a mex routine that takes a 2D double complex input (caution: no argument checking done!) ...

Complex matrix inversion using LAPACK in MEX

I took your code and modified it to be a mex routine that takes a 2D double complex input (caution: no argument checking done!) ...

ungefär en månad ago | 0

Answered

how to reshape this matrix

result = reshape(A.',2,[]).'

how to reshape this matrix

result = reshape(A.',2,[]).'

ungefär 2 månader ago | 0

| accepted

Answered

Simulation of irrational numbers

The random number generators that come with MATLAB have very long periods. You can simply use them to form your ratio and it wi...

Simulation of irrational numbers

The random number generators that come with MATLAB have very long periods. You can simply use them to form your ratio and it wi...

ungefär 2 månader ago | 0

Answered

Printing out the element values in a mxDouble array (C++ script in Matab)

%d is a decimal integer format for use with short, int, long, etc. This doesn't work with floating point. Try e.g. %f or %g inst...

Printing out the element values in a mxDouble array (C++ script in Matab)

%d is a decimal integer format for use with short, int, long, etc. This doesn't work with floating point. Try e.g. %f or %g inst...

ungefär 2 månader ago | 0

| accepted

Answered

Runge-Kutta function

Here is some code to get you started. It receives a string from the user for a derivative function of x and t and turns it into...

Runge-Kutta function

Here is some code to get you started. It receives a string from the user for a derivative function of x and t and turns it into...

ungefär 2 månader ago | 1

Answered

for loop continued fraction

Yes, you can use the formula x(n) = 1 + 1/x(n-1) if you want to use a loop. Just start with x(1) = 1.

for loop continued fraction

Yes, you can use the formula x(n) = 1 + 1/x(n-1) if you want to use a loop. Just start with x(1) = 1.

ungefär 2 månader ago | 0

Answered

How to sum up multiple vectors, element by element, to recieve one final value?

The numerator is just a simple dot product between two vectors, and the denominator is just a simple sum. Using the fact that a...

How to sum up multiple vectors, element by element, to recieve one final value?

The numerator is just a simple dot product between two vectors, and the denominator is just a simple sum. Using the fact that a...

ungefär 2 månader ago | 1

Answered

Creating a 2D random walk

In this logic, you will never get to the y branches because one of the first two x branches will always be true: if p_x<0.6 ...

Creating a 2D random walk

In this logic, you will never get to the y branches because one of the first two x branches will always be true: if p_x<0.6 ...

ungefär 2 månader ago | 0

Answered

Is Walter Roberson a real person, or is he some kind of Matlab AI robot?

Blade Runner 2019 ...

Is Walter Roberson a real person, or is he some kind of Matlab AI robot?

Blade Runner 2019 ...

ungefär 2 månader ago | 1

Answered

single precision simulation of internal calculations

" Is there a way to set Matlab to perform all calculations (even internal) to single precision? " Not the way you are probably ...

single precision simulation of internal calculations

" Is there a way to set Matlab to perform all calculations (even internal) to single precision? " Not the way you are probably ...

ungefär 2 månader ago | 0

| accepted

Answered

How do i convert this for loop into a while loop?

This for loop: for i=1:n % stuff end is equivalent to this while loop: i = 1; while i <= n % stuff i = i + 1...

How do i convert this for loop into a while loop?

This for loop: for i=1:n % stuff end is equivalent to this while loop: i = 1; while i <= n % stuff i = i + 1...

ungefär 2 månader ago | 1

| accepted

Answered

How can I vertically concatenate cells?

I don't have much of a clue what you really need, but maybe this will give you a start on the MATLAB cell array syntax (with the...

How can I vertically concatenate cells?

I don't have much of a clue what you really need, but maybe this will give you a start on the MATLAB cell array syntax (with the...

ungefär 2 månader ago | 0

Answered

Functions, Error check

From your description, it seems like you simply need to test for the number of characters. E.g., while numel(outstring) == 0

Functions, Error check

From your description, it seems like you simply need to test for the number of characters. E.g., while numel(outstring) == 0

ungefär 2 månader ago | 0

| accepted

Answered

How to implement such function?

Basically, just replace f(x) with f. E.g., f = constant; : f = coeffVector(i) * cos(i*x) + f; You could also do this wit...

How to implement such function?

Basically, just replace f(x) with f. E.g., f = constant; : f = coeffVector(i) * cos(i*x) + f; You could also do this wit...

ungefär 2 månader ago | 0

Answered

How to from I(x) to permutation and from permutation to I(x)

E.g., >> Per Per = 0 1 2 3 0 2 3 1 0 3 1 2 3 2 0 1 ...

How to from I(x) to permutation and from permutation to I(x)

E.g., >> Per Per = 0 1 2 3 0 2 3 1 0 3 1 2 3 2 0 1 ...

ungefär 2 månader ago | 0

Answered

case of two mappings

Not sure which one is first, but maybe one of these is what you want? >> mapping1 = [0 1 3 2] mapping1 = 0 1 3 ...

case of two mappings

Not sure which one is first, but maybe one of these is what you want? >> mapping1 = [0 1 3 2] mapping1 = 0 1 3 ...

ungefär 2 månader ago | 0

Answered

what wrong about this error

The error message appears when you have a mismatch in the number of elements on the rhs and the number of elements on the lhs. E...

what wrong about this error

The error message appears when you have a mismatch in the number of elements on the rhs and the number of elements on the lhs. E...

ungefär 2 månader ago | 0

Answered

Why is subtracting different sized matrices not giving me an error? What is matlab calculating?

See documentation on "implicit expansion" https://www.mathworks.com/help/matlab/matlab_prog/compatible-array-sizes-for-basic-op...

Why is subtracting different sized matrices not giving me an error? What is matlab calculating?

See documentation on "implicit expansion" https://www.mathworks.com/help/matlab/matlab_prog/compatible-array-sizes-for-basic-op...

ungefär 2 månader ago | 0

| accepted

Answered

store values from loop in an array

Typos in your code: for i=1:length(A) And change tableA to TableA (MATLAB is case sensitive). Or, you could get rid of the l...

store values from loop in an array

Typos in your code: for i=1:length(A) And change tableA to TableA (MATLAB is case sensitive). Or, you could get rid of the l...

ungefär 2 månader ago | 0

| accepted

Answered

Combination of X and Y vectors to get all possible positions on a Cartesian plane

[XX,YY] = ndgrid(X,Y); Z = [XX(:),YY(:)];

Combination of X and Y vectors to get all possible positions on a Cartesian plane

[XX,YY] = ndgrid(X,Y); Z = [XX(:),YY(:)];

ungefär 2 månader ago | 0

| accepted

Submitted

C Mex MATLAB Version

Mex C code to determine MATLAB version at compile time and run time

ungefär 2 månader ago | 8 downloads |

Submitted

SHAREDCHILD creates a shared data copy of contiguous subset

SHAREDCHILD creates a shared data copy of a contiguous subsection of an existing variable

ungefär 2 månader ago | 4 downloads |

Answered

mxCreateNumericArray error: cannot convert 'int*' to 'const size_t* {aka const long long unsigned int*}' for argument '2' to 'mxArray*

Simply replace this int* dims = new int[par->ndim]; with this mwSize* dims = new mwSize[par->ndim];

mxCreateNumericArray error: cannot convert 'int*' to 'const size_t* {aka const long long unsigned int*}' for argument '2' to 'mxArray*

Simply replace this int* dims = new int[par->ndim]; with this mwSize* dims = new mwSize[par->ndim];

2 månader ago | 1

| accepted

Answered

How do I implement bsxfun column-wise?

C = arrayfun(@(i)func(A(:,i),B(i)),1:size(A,2)) This just hides the loops behind arrayfun ... it doesn't eliminate them.

How do I implement bsxfun column-wise?

C = arrayfun(@(i)func(A(:,i),B(i)),1:size(A,2)) This just hides the loops behind arrayfun ... it doesn't eliminate them.

2 månader ago | 1

Answered

how to replace a column in a matrix

Instead of replacing all of the columns of A, use a different variable for the result. E.g., a cell array named C. So instead o...

how to replace a column in a matrix

Instead of replacing all of the columns of A, use a different variable for the result. E.g., a cell array named C. So instead o...

2 månader ago | 0

| accepted

Answered

Function Return only one value

Call it with two requested outputs: [X,Y] = MyEKFFun(31,24,18,330,364,379,1,1.1,1.3,2) Since you were calling it with no reque...

Function Return only one value

Call it with two requested outputs: [X,Y] = MyEKFFun(31,24,18,330,364,379,1,1.1,1.3,2) Since you were calling it with no reque...

2 månader ago | 3

Answered

any easier way to find cell by string

Assuming the strings all start with 'test', e.g. find(cellfun(@(C)C(end)=='a',A))

any easier way to find cell by string

Assuming the strings all start with 'test', e.g. find(cellfun(@(C)C(end)=='a',A))

2 månader ago | 0

| accepted

Answered

cant workout why vectors aren't the same length

If you pass zeros( ) only one argument, it creates a square 2D matrix, not a vector. So give it two arguments to make your resul...

cant workout why vectors aren't the same length

If you pass zeros( ) only one argument, it creates a square 2D matrix, not a vector. So give it two arguments to make your resul...

2 månader ago | 0

Answered

Question about array alternating between positive and negative

Seems like there should be a shorter way, but assuming you are looking for all 0 crossings and not just the positive to negative...

Question about array alternating between positive and negative

Seems like there should be a shorter way, but assuming you are looking for all 0 crossings and not just the positive to negative...

2 månader ago | 0

| accepted