Answered
Velocity,Acceleration,Angle
This is a dynamics class. Dynamics involves derivatives. How can you be in a dynamics class without knowing calculus and how t...

5 years ago | 1

| accepted

Answered
Randi(imax,m,n)
The point is that once the eps of the max value is greater than 1, you cannot represent contiguous sets of integer values in dou...

5 years ago | 2

Answered
How this code works and why for? What action does this code take?
You could look here: https://en.wikipedia.org/wiki/Bubble_sort

5 years ago | 1

Answered
Creating all possible combination of a letter/string
One way to create a matrix of these character strings: dem_a='ABC'; % assume starting string is all upper n = numel(dem_a); r...

5 years ago | 1

| accepted

Answered
Implementation of a matrix
You haven't told us what x and e are, but assuming x is a vector and e is a scalar, simply this: result = cos( (1:n) .* x(:) * ...

5 years ago | 4

| accepted

Answered
Array indices must be positive integers or logical values.
n = 0 and then you use it as an index: n=0; for i=n:1:tam-1 if xi(n)*xi(n+1)<0 You can't have a 0 index. Also, min is t...

6 years ago | 0

Answered
Formatting floating and integer signed numbers
sprintf("%0.2f%+0.2f",a,b) Having the + inside the %format stuff forces the sign to print.

6 years ago | 0

| accepted

Answered
For-loop in MATLAB
You should not modify the index variable i inside the loop: for i = 1:length(Corr_vector) : i=i+44; % this is ba...

6 years ago | 0

Answered
Finding All Combinations of Elements in a Vector
N = 6; result = dec2bin((0:(2^N-1))') - '0'; Then the various vectors you want are the rows of result. Or, if you really want...

6 years ago | 1

| accepted

Answered
About floating point format
The 64-bit floating point format is IEEE double: https://en.wikipedia.org/wiki/Double-precision_floating-point_format The 32-b...

6 years ago | 0

Answered
vector multiplied a matrix
Maybe this is what you want if c is 5 x 1 and T is 5 x 101: f = c.' * T;

6 years ago | 1

| accepted

Answered
why do i receive this error?
You have written a file called input.m that is shadowing the MATLAB function of the same name. You need to rename your input.m ...

6 years ago | 0

Submitted


num2strexact (exact version of num2str)
num2strexact does exact conversion of number to string based on IEEE floating point bit pattern

6 years ago | 1 download |

5.0 / 5
Thumbnail

Answered
Binary to DNA sequence conversion
x = A(i:i+1); But if you are going to process pairs of characters in A, then maybe you need to step by 2 as well, e.g. for i=1...

6 years ago | 0

| accepted

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...

6 years 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...

6 years 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" ...

6 years 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])...

6 years ago | 1

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...

6 years ago | 1

| accepted

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...

6 years 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)...

6 years 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...

6 years 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,:);

6 years 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...

6 years 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. ...

6 years ago | 1

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)...

6 years 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...

6 years 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...

6 years 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...

6 years 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...

6 years ago | 0

Load more