Answered

Manipulating dimensions without using loops

It looks like the indexing is consecutive, it is just that you have a mixture of reshaping (which doesn't change memory order of...

Manipulating dimensions without using loops

It looks like the indexing is consecutive, it is just that you have a mixture of reshaping (which doesn't change memory order of...

24 days ago | 0

Answered

How can I rotate a set of points around an axis?

Arrange your points as column vectors and do a matrix multiply. E.g., result = rotmxXYZ * K.'; The result will have your point...

How can I rotate a set of points around an axis?

Arrange your points as column vectors and do a matrix multiply. E.g., result = rotmxXYZ * K.'; The result will have your point...

25 days ago | 0

| accepted

Answered

Solve linear least square problems with non-linear constraints

If you have two sets of corresponding points from two different coordinate systems and you are simply trying to find the "best" ...

Solve linear least square problems with non-linear constraints

If you have two sets of corresponding points from two different coordinate systems and you are simply trying to find the "best" ...

25 days ago | 0

Answered

Error using mex : In function 'void mexFunction(int, mxArray**, int, const mxArray**)'

The error is not with mexFunction. The error is with line in your source code: const int32_t *dims1 = mxGetDimensions(prhs[1])...

Error using mex : In function 'void mexFunction(int, mxArray**, int, const mxArray**)'

The error is not with mexFunction. The error is with line in your source code: const int32_t *dims1 = mxGetDimensions(prhs[1])...

25 days ago | 0

Answered

How to change code from C to matlab script?

This is just straightforward arithmetic, so the conversion is pretty simple. I would forget about using single precision floats...

How to change code from C to matlab script?

This is just straightforward arithmetic, so the conversion is pretty simple. I would forget about using single precision floats...

25 days ago | 0

Answered

Relative rotation between two IMU's

Assuming the coordinate frames are as follows: ECI, the world frame BODY1, the IMU1 body frame BODY2, the IMU2 body frame Ex...

Relative rotation between two IMU's

Assuming the coordinate frames are as follows: ECI, the world frame BODY1, the IMU1 body frame BODY2, the IMU2 body frame Ex...

25 days ago | 0

| accepted

Answered

How much money will I accumulate over x amount of years

Those last three lines need to be put into a loop. That is, each month this happens to the balance balance = balance * (1 + r)...

How much money will I accumulate over x amount of years

Those last three lines need to be put into a loop. That is, each month this happens to the balance balance = balance * (1 + r)...

28 days ago | 0

Answered

Fibonacci.m for Fibonacci Series

You function is not vectorized ... that is, it is not written to handle anything other than a scalar input. As written, you wou...

Fibonacci.m for Fibonacci Series

You function is not vectorized ... that is, it is not written to handle anything other than a scalar input. As written, you wou...

28 days ago | 0

| accepted

Answered

slicing matrix in efficient way

Another way: a = 1:120; r = reshape(a,30,[]); x = r( 1:10,:); y = r(11:20,:); z = r(21:30,:);

slicing matrix in efficient way

Another way: a = 1:120; r = reshape(a,30,[]); x = r( 1:10,:); y = r(11:20,:); z = r(21:30,:);

28 days ago | 1

Answered

ode45 and euler not working for random signal

You can't use random inputs with ode45( ). ode45( ) relies on the ability to call the derivative function at arbitrary times to...

ode45 and euler not working for random signal

You can't use random inputs with ode45( ). ode45( ) relies on the ability to call the derivative function at arbitrary times to...

28 days ago | 0

Answered

Fourth Order Runge-Kutta Method for the System of three Differential Equation

I don't really want to sift through all of that code, mostly because you are using different variables for the various states. ...

Fourth Order Runge-Kutta Method for the System of three Differential Equation

I don't really want to sift through all of that code, mostly because you are using different variables for the various states. ...

28 days ago | 0

Answered

calling a c function with calllib doesn't work with pointers

A basic general outline of freeing the memory would be: double *sortie = NULL; // top level variable void free_sortie(void)...

calling a c function with calllib doesn't work with pointers

A basic general outline of freeing the memory would be: double *sortie = NULL; // top level variable void free_sortie(void)...

28 days ago | 0

Answered

Problem using a mex.c file

Looks like you need to compile the mex file. You will need to install a C compiler if you haven't already. If there is a build...

Problem using a mex.c file

Looks like you need to compile the mex file. You will need to install a C compiler if you haven't already. If there is a build...

29 days ago | 0

Answered

View Reshape Function Code

All it basically does is replace the dimensions with the requested dimensions in the internal variable header. There wouldn't b...

View Reshape Function Code

All it basically does is replace the dimensions with the requested dimensions in the internal variable header. There wouldn't b...

1 month ago | 1

| accepted

Answered

arrayfun syntax and use with scalar input

To use a scalar you could use this syntax: a=[1 2;3 4]; b=2; c=arrayfun(@(x)x+b,a); The function handle would pi...

arrayfun syntax and use with scalar input

To use a scalar you could use this syntax: a=[1 2;3 4]; b=2; c=arrayfun(@(x)x+b,a); The function handle would pi...

1 month ago | 0

| accepted

Answered

Access violation detected - MEX

If it worked fine on 32-bit, then of course the most likely problem is you missed something in the integer or pointer size conve...

Access violation detected - MEX

If it worked fine on 32-bit, then of course the most likely problem is you missed something in the integer or pointer size conve...

1 month ago | 0

Answered

Use of arrayfun but with passing a fixed variable to function handle?

matrix(:,3) = arrayfun(@(a,b)max(diff(spikeTimes(a:b))),start_temp,stop_temp);

Use of arrayfun but with passing a fixed variable to function handle?

matrix(:,3) = arrayfun(@(a,b)max(diff(spikeTimes(a:b))),start_temp,stop_temp);

1 month ago | 0

| accepted

Answered

howto organize an array into groups of n-Elements

Another way: x = 1:100; a = reshape (x,5,20); aa = [a;a]; v = cell(1,5); for k=1:5 v{k} = aa(k:k+4,:); end Then the ...

howto organize an array into groups of n-Elements

Another way: x = 1:100; a = reshape (x,5,20); aa = [a;a]; v = cell(1,5); for k=1:5 v{k} = aa(k:k+4,:); end Then the ...

1 month ago | 0

| accepted

Answered

using for loop with if

I'm guessing you want a newline at the end? fprintf(' Ik = %.f \n', abs (Ik))

using for loop with if

I'm guessing you want a newline at the end? fprintf(' Ik = %.f \n', abs (Ik))

1 month ago | 0

Answered

movements of the descent vehicle in the atmosphere of Earth

You have four differential equations involving four variables: V, theta, H, and L. You have to solve these simultaneously since...

movements of the descent vehicle in the atmosphere of Earth

You have four differential equations involving four variables: V, theta, H, and L. You have to solve these simultaneously since...

1 month ago | 0

| accepted

Answered

Error: Matrix dimensions must agree & Error: Function called failed while converting my code to C

This line: mat = (z).^(0:n+1); uses implicit expansion. z is a column vector and (0:n+1) is a row vector, so the result is in...

Error: Matrix dimensions must agree & Error: Function called failed while converting my code to C

This line: mat = (z).^(0:n+1); uses implicit expansion. z is a column vector and (0:n+1) is a row vector, so the result is in...

1 month ago | 0

| accepted

Answered

Can somebody help me to modify this code?

In this Brot = q.B.(q^-1) and this B = (q^-1). Brot.q expression, the dot (.) is likely supposed to represent quaternion mul...

Can somebody help me to modify this code?

In this Brot = q.B.(q^-1) and this B = (q^-1). Brot.q expression, the dot (.) is likely supposed to represent quaternion mul...

1 month ago | 0

Answered

How can I call a *.dll file on a Mac?

dll's are compiled object code specific to the machine type they are compiled for. Are you trying to load the same dll file on ...

How can I call a *.dll file on a Mac?

dll's are compiled object code specific to the machine type they are compiled for. Are you trying to load the same dll file on ...

1 month ago | 0

| accepted

Answered

Inefficiency in MEX function when passing data into output

I am not sure you have enough insight into how codegen is going to code the randi, bsxfun, times, and sum functions to get what ...

Inefficiency in MEX function when passing data into output

I am not sure you have enough insight into how codegen is going to code the randi, bsxfun, times, and sum functions to get what ...

1 month ago | 1

Answered

Invalid Mex file: Undefined symbol: mxrErrMsgTxt

All of the mxGetErrMsg references have been commented out in your posted code, so that is not the problem. I would guess that y...

Invalid Mex file: Undefined symbol: mxrErrMsgTxt

All of the mxGetErrMsg references have been commented out in your posted code, so that is not the problem. I would guess that y...

1 month ago | 0

| accepted

Answered

I have a C function created using Compiler CDK and it's returning a large array but it's MxArray** type. How do I access all the data retunred to the calling C function?

A function signature like that typically means that the mlfMPrime_CA_P( ) function is creating an mxArray and then returning the...

I have a C function created using Compiler CDK and it's returning a large array but it's MxArray** type. How do I access all the data retunred to the calling C function?

A function signature like that typically means that the mlfMPrime_CA_P( ) function is creating an mxArray and then returning the...

1 month ago | 0

Answered

[SOLVED] Why is 'size_t' in external C library interpreted wrong?

I am unaware of MATLAB treating size_t differently, but there is a potential error in your code snippet: int foo(size_t sz, uin...

[SOLVED] Why is 'size_t' in external C library interpreted wrong?

I am unaware of MATLAB treating size_t differently, but there is a potential error in your code snippet: int foo(size_t sz, uin...

1 month ago | 0

Answered

How can I speed up an exponential function?

I'm not sure what the issue is since you seem to already know about logical indexing. E.g., test1 = your data x = test1 > 0.0...

How can I speed up an exponential function?

I'm not sure what the issue is since you seem to already know about logical indexing. E.g., test1 = your data x = test1 > 0.0...

1 month ago | 2

| accepted

Answered

Result of asind changed between R2016b and R2019b

This is a bit strange. I would have expected the later version to be better, but it appears to be worse: >> version -release ...

Result of asind changed between R2016b and R2019b

This is a bit strange. I would have expected the later version to be better, but it appears to be worse: >> version -release ...

1 month ago | 0