Réponse apportée
The Body Mass Index, or BMI
Just get rid of these lines: function BMI=findbmi(Weight,Height)

presque 6 ans il y a | 1

Réponse apportée
From where is this exp in syms calculus?
The solution space has multiple values, not just one. The solver has parameterized the solution space for you. There are multi...

presque 6 ans il y a | 0

| A accepté

Réponse apportée
simulate a dice throw
doc randi E.g., for a single throw you could use randi(6)

presque 6 ans il y a | 1

| A accepté

Réponse apportée
Why do I get "Array indices must be positive integers or logical values" error when using?
k is 3.5 So y(k-1) is y(2.5) and y(k-2) is y(1.5). The indexes are not positive integers, hence the error. Maybe you meant ...

presque 6 ans il y a | 0

| A accepté

Réponse apportée
How to fill mxArray with mxGetComplexDoubles?
No, this would not be expected to work. In the first place, you need to use mxDOUBLE_CLASS to create the mxArray, not mxSINGLE_...

presque 6 ans il y a | 0

| A accepté

Réponse apportée
The spacecraft free-fall math model
See this link for an example of the parachute problem: https://www.mathworks.com/matlabcentral/answers/516385-code-not-working-...

presque 6 ans il y a | 0

Réponse apportée
Satellite Orbit, Friction Acceleration Function
See this link for an example that uses atmospheric drag with a satellite (in this case a satellite falling to Earth): https://w...

presque 6 ans il y a | 0

Réponse apportée
Fibonacci Series Using Recursive Function
All of your recursive calls decrement n-1. Eventually you will wind up with the input n=0 and just return v=0, which is not wha...

presque 6 ans il y a | 0

Réponse apportée
How to fix error: "Index in position 1 is invalid. Array indices must be positive integers or logical values"
Type the following at the command line: dbstop if error Then run your code. When the error occurs, the code will pause with a...

presque 6 ans il y a | 0

| A accepté

Réponse apportée
Why do I get this error message "Array indices must be positive integers or logical values."
You forgot to multiply between the y and (y-1) Z = x(:).^2.*y.*(y-1).*(y+1); Also, make sure to use element-wise operators (wi...

presque 6 ans il y a | 0

Réponse apportée
pointers in object-oriented matlab programing
MATLAB does not have variable pointers ... at least not in the sense of C/C++ like you are probably alluding to.

presque 6 ans il y a | 0

Réponse apportée
Recursion in matrix calculation
This uses recursive calls (CalDet calls CalDet with smaller matrices until the size is 1x1). I.e., the recursion continues all ...

presque 6 ans il y a | 1

Réponse apportée
How C++ gets struct values from Matlab
Looks like your strings are char type and not the newer string type. So you can try the following: mxArray *mx; char *name; ...

presque 6 ans il y a | 0

Réponse apportée
Checking whether two complex matrices are equal
You can't rely on floating point calculations to give exact results. See this link: https://ch.mathworks.com/matlabcentral/ans...

presque 6 ans il y a | 2

| A accepté

Réponse apportée
IMU orientation using AHRS filter
I haven't used either of those functions, but from reading the doc maybe you need to use the conjugate of the quaternions in you...

presque 6 ans il y a | 1

Réponse apportée
Quick way to Invert the matrix (A+D) where the inverse of matrix A is known and the matrix D is diagonal.
Are the values in D small compared to A^-1 ? Maybe you can make use of one of the forms listed here: https://en.wikipedia.org/...

presque 6 ans il y a | 0

Réponse apportée
How do I program the orbit of a particle that is experiencing Gravity & Radiation Force Pressure?
The differential equation is simply Newton's F = ma, where m is the mass of the object (M1) and a is the acceleration of the obj...

presque 6 ans il y a | 0

Réponse apportée
Numerical integration RK4 for the given data
E.g., a VERY SIMPLISTIC approach showing one step of Euler integration dt = some delta time value q = [1,0,0,0]; % Initial qua...

presque 6 ans il y a | 0

| A accepté

Réponse apportée
How to convert this 2D code segment with random number into the FORTRAN code?
For your particular case, looks like the MATLAB code could reduce to: Nx = 4; Ny = 4; c1 = 0.12; rr = 0.0001; D = c1 + rr*(...

presque 6 ans il y a | 1

Réponse apportée
Matrix multiply result different from loops
MATLAB calls 3rd party BLAS library code to do matrix multiply. This is a highly optimized multi-threaded library. The orderin...

presque 6 ans il y a | 1

| A accepté

Réponse apportée
Why does defining a system of ODEs a different, but similar way yield very different solutions?
Do you simply need to apply that factor in the 6th spot? (kred(t)*CNiIIIH - kox(t)*CNiIIH - k2*CNiIIH*CH)*(96485.33289/1e9);

presque 6 ans il y a | 0

Réponse apportée
atan2(0,0) is not undefined (NaN)
This is a documented convention. https://ch.mathworks.com/help/matlab/ref/atan2.html

presque 6 ans il y a | 0

Réponse apportée
How to use not equal in for loop
You could use a while loop. E.g., t = 0; while( t ~= 1 ) % code % at some point, either set t=1 or break out of loop...

presque 6 ans il y a | 0

Réponse apportée
Given that A is a sparse matrix, norm(A(i,:)) takes a very long time. Why and can one do better ?
Will you eventually need all of the rows? E.g., do this once at the beginning outside the loop n = sqrt(sum(A.^2,2)) And then...

presque 6 ans il y a | 0

Réponse apportée
8bit binary sub string to unsigned integer in matlab
doc bin2dec

presque 6 ans il y a | 0

Réponse apportée
Indexing in fields of a struct
Loops are what is needed here, but you can hide the loops behind function calls if you want. E.g., k = 3; % the number you are...

presque 6 ans il y a | 0

| A accepté

Réponse apportée
Using FP16 data in MATLAB
If you have R2018b or later, you can fread as uint16 and then typecast into half type. E.g., % Generate some sample data >> d...

presque 6 ans il y a | 1

| A accepté

Réponse apportée
I'm new to matlab and am trying to sort an array in ascending order without using the sort command. How would I rectify this?
This is a "bubble sort" and you have two problems. First, as mentioned by Walter, is your indexing max value is one too big. Y...

presque 6 ans il y a | 1

Réponse apportée
Preallocating a sparse matrix, then entering values column by column takes too much time. Is there a more efficient way ?
The problem is that every time you change the elements of Q, even if it is only one element change, MATLAB generally has to copy...

presque 6 ans il y a | 0

Réponse apportée
How to optimize matrix multiplication speed?
This looks like a covariance matrix update to me. The matrix multiplies are already done by highly optimized multi-threaded com...

presque 6 ans il y a | 0

Charger plus