How do I create a matrix with all binary combinations?
dec2bin(0:2^N-1) - '0' Note that this is only practical for relatively small values of N. Even moderatly large N can cause thi...

24 días ago | 1

Not getting expected results
I get the identity matrix with your code: >> phi = 0; >> psi = 0; >> theta = 0; >> R=[cosd(phi).*cosd(psi)-sind(phi)...

25 días ago | 1

Obtain specific dimension from multidimensional Arrays
Not really sure what you are asking, but if you only want to pick off some indexes from an arbitrary dimension, simply supply th...

25 días ago | 0

How to exit a while loop after a certain number of values have been saved to a matrix
The general form for while loops is typically some variation of these: while( condition ) % stuff that eventually alters t...

25 días ago | 0

Using an array as input argument of a function handle
c = num2cell(a); J_num = J(c{:});

25 días ago | 0

| accepted

How to find the average of monte carlo simulation
You could save the r's in a vector. E.g., r(i) = poissrnd(lambda); Or you could generate all of the r's at once without the lo...

25 días ago | 0

| accepted

error decimal aproximation, extra decimal
Welcome to the world of floating point arithmetic! See this link: https://www.mathworks.com/matlabcentral/answers/57444-faq-wh...

26 días ago | 0

For loop for multiple scenarios
E.g., for k=1:numel(h_max) % use h_max(k), a_max(k), and SM(k) in your code here end Or if they need to vary independent...

26 días ago | 0

How to write a function to determine if the inputed date is valid.Whats wrong with my valid_date function?
Consider these lines: if( any(month == [4,6,9,11]) && day<=30 ) % <-- if you pass this test valid = true; ...

26 días ago | 0

calculate the probability of tomorrow's climate
The normal distrubion is a continuous distribution. To answer questions like "probability of temp greater than" or "less than"...

26 días ago | 0

how can I display my result: the problem on fprintf command
The format string is first, not last. E.g., fprintf('%s\n\r', expo_result);

26 días ago | 0

| accepted

Out of memory Problem [Problem 2 , Project Euler (Sum of even Fibonacci numbers)]
Don't store all of the numbers as you go and then add them up at the end. Only keep a few numbers in memory at one time and do ...

27 días ago | 0

What is the convention of the new quaternion( ) class introduced in R2018b?
The new quaternion( ) class introduced in R2018b is a generic class. The functions it uses can be made to be consistent with qu...

27 días ago | 1

Question

What is the convention of the new quaternion( ) class introduced in R2018b?
MATLAB introduced a new quaternion( ) class in R2018b. How does this compare to other existing quaternion functionality in MATL...

27 días ago | 1 answer | 1

### 1

how to convert a rotation matrix to a rotation vector
I can't find the computeRotationVectorForAnglesCloseToPi( ) function. Where is this from? The "(w,v) is a unit quaternion" sta...

27 días ago | 0

Matrix Error when typed in
This is just a display issue. All values are what you entered (or, at least the closest IEEE double representation). That 1.0e...

27 días ago | 0

Can we solve this problem without using sort?
Introductory programming classes usually start with the bubble sort. See here for the algorithm in pseudo-code: https://en.wik...

28 días ago | 0

How can I add a column to existent 3D matrix
First, you need to realize that the size of your insert will be 180 x 1 x 107. I.e., it is not just a 180 element column you ne...

28 días ago | 0

| accepted

Ambiguity in DCM to Quaternion conversion using the default Simulink library block
Quaternions used for rotations have an inherent sign ambiguity, as you seem to already know. That is, -q produces the same rota...

28 días ago | 0

Why is the Euler Output of the Quaternion Block different than the Euler Angles block in the Aerospace Blockset?
On a related note, the Aerospace Toolbox uses a different quaternion convention than the Robotics Toolbox. One is basically the...

28 días ago | 0

rotate a vector by orientation defined by Euler angles
MATLAB uses two different quaternion conventions in their toolboxes. The Aerospace Toolbox quaternion convention is essentially...

29 días ago | 0

Is quaternion multiplication associative?
You just need to simplify it to see that the result is in fact 0's. E.g., running your code gives this for X-Y: ans = [ cos(t...

29 días ago | 0

how to make Ascii 7 bit in matlab
MATLAB uses ASCII for encoding characters. So you can just do this to get the characters: ASCII = char(0:127);

alrededor de 1 mes ago | 0

Get the factorial of an array
The factorial( ) function is vectorized, so just call it: >> n = [1 9 1 3 7 2 5 4 0 9]; >> factorial(n) ans = Columns 1 t...

alrededor de 1 mes ago | 1

Commands for Simulations using Quaternions
Not to be flippant, but the cheapest way is to not buy a toolbox just for the functions you need, but simply write your own func...

alrededor de 1 mes ago | 1

Feedback control - need to update an algebraic variable within ODE function.
I think you are using the wrong tool for this. ode45( ) is an adaptive integrator, which means that it has the freedom to chang...

alrededor de 1 mes ago | 1

general vector code question
MATLAB does not support the i, j, k quaternion "complex" numbers. The i and j in MATLAB are strictly the ordinary imaginary num...

alrededor de 1 mes ago | 0

help With rotating vectors
We need more detail. Your quat_2_new is a unit quaternion, so it can be used for rotations. If your quat_1 is just supposed to...

alrededor de 1 mes ago | 0

quat2eul(quat) and dcm2Angle(R) difference for ZYX sequence
MATLAB uses two different quaternion conventions in their toolboxes. In particular, the quaternion convention used in the Aeros...

alrededor de 1 mes ago | 1

| accepted