Answered

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

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

17 dagar ago | 0

Answered

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

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

18 dagar ago | 0

Answered

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

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

18 dagar ago | 0

| accepted

Answered

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

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

18 dagar ago | 0

Answered

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

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

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

19 dagar ago | 1 answer | 1

Answered

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

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

19 dagar ago | 0

Answered

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

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

19 dagar ago | 0

Answered

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

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

19 dagar ago | 0

Answered

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

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

19 dagar ago | 0

| accepted

Answered

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

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

20 dagar ago | 0

Answered

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

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

20 dagar ago | 0

Answered

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

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

21 dagar ago | 0

Answered

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

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

21 dagar ago | 0

Answered

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

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

21 dagar ago | 0

Answered

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

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

21 dagar ago | 1

Answered

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

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

22 dagar ago | 1

Answered

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

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

22 dagar ago | 1

Answered

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

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

22 dagar ago | 0

Answered

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

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

22 dagar ago | 0

Answered

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

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

22 dagar ago | 1

| accepted

Answered

Memory allocation for structure array

The 112 I think is an estimate of the size of an mxArray header (the internal structure for each variable that MATLAB uses behin...

Memory allocation for structure array

The 112 I think is an estimate of the size of an mxArray header (the internal structure for each variable that MATLAB uses behin...

22 dagar ago | 1

Answered

using logic with units - can it be done?

Don't use == for single quoted strings, since that will do an element-by-element calculation. So this if (data.units == 'm/s')...

using logic with units - can it be done?

Don't use == for single quoted strings, since that will do an element-by-element calculation. So this if (data.units == 'm/s')...

22 dagar ago | 0

| accepted

Answered

Why do i keep getting this," Incorrect use of '=' operator." error?

This is not valid MATLAB syntax: for m=1:M & n=0:N Maybe you wanted nested for loops? for m=1:M for n=0:N z = z+...

Why do i keep getting this," Incorrect use of '=' operator." error?

This is not valid MATLAB syntax: for m=1:M & n=0:N Maybe you wanted nested for loops? for m=1:M for n=0:N z = z+...

22 dagar ago | 0

| accepted

Answered

Add Consecutive Numbers sent to a Matrix in a Matlab Function

Sounds like maybe you want persistent variable behavior. E.g., function travel_dist = DeltaDistance(x) persistent y if( isemp...

Add Consecutive Numbers sent to a Matrix in a Matlab Function

Sounds like maybe you want persistent variable behavior. E.g., function travel_dist = DeltaDistance(x) persistent y if( isemp...

23 dagar ago | 0

| accepted

Answered

Recursive definition of anonymous function

@(x) STUFF Takes a snapshot of all of the workspace variables used in STUFF in order to create the function handle. It doesn't...

Recursive definition of anonymous function

@(x) STUFF Takes a snapshot of all of the workspace variables used in STUFF in order to create the function handle. It doesn't...

23 dagar ago | 1

| accepted

Answered

help PLease, RK4!

You left out some * operators on the k2 and k3. This fy = @(time,x1,x2,x3) m2*x2+c3*(x2-x3)+c2*(x2-x1)+k3*(x2-x3)+k2(x2-x1); f...

help PLease, RK4!

You left out some * operators on the k2 and k3. This fy = @(time,x1,x2,x3) m2*x2+c3*(x2-x3)+c2*(x2-x1)+k3*(x2-x3)+k2(x2-x1); f...

23 dagar ago | 1

Answered

OpenMP in mex file only produces 1 thread

What if you try to force it? E.g., #pragma omp parallel num_threads(omp_get_max_threads()) Or maybe omp_set_num_threads(omp_...

OpenMP in mex file only produces 1 thread

What if you try to force it? E.g., #pragma omp parallel num_threads(omp_get_max_threads()) Or maybe omp_set_num_threads(omp_...

24 dagar ago | 1

| accepted

Answered

if x=0

x = input('x value: '); y = input('y value: '); k = x * y; if k == 6 % <-- Use == for equality test k1 = 2; elseif k ...

if x=0

x = input('x value: '); y = input('y value: '); k = x * y; if k == 6 % <-- Use == for equality test k1 = 2; elseif k ...

24 dagar ago | 0

| accepted

Answered

Performing calculations on a vector

The log10( ) function is vectorized, so just this result = 20 * log10(4*pi*d./lambda);

Performing calculations on a vector

The log10( ) function is vectorized, so just this result = 20 * log10(4*pi*d./lambda);

24 dagar ago | 0

| accepted