Answered
ASCII multiplication returns array of numbers
The characters are converted to double values (ASCII code numbers) and then multiplied. That is the way the * operator works fo...

6 years ago | 0

Answered
Mex function out plhs[0] is all zeros
There are three problems with your code. 1) Assigning the value of a pointer to another pointer does not attach the pointer to ...

6 years ago | 1

| accepted

Answered
Weird output and calling to another function
That's because you are returning m. I think you want to return z: function z = primefactors(m)

6 years ago | 0

| accepted

Answered
How to use Shuffle.c index mode for complex numbers
Note: Compiling mex code in R2018a or later with the '-R2017b' option will cause the mex routine to make deep copies of all comp...

6 years ago | 0

Answered
vector multiplication with its transpose
Variables and expressions in MATLAB need an operator between them ... there is no implied multiply. So this (y(t+1)-y(t))'W(y(t...

6 years ago | 0

Answered
Matrix dimensions must agree error
t and g look like they are vectors, so use element-wise operators (with the . dot) when dealing with equations involving them. E...

6 years ago | 0

Answered
Finding the if the complex numbers with the imaginary part not equal to zero (array)
The equality conditional operator in MATLAB is the double equals ==, so y = sp(imag(sp)==0)

6 years ago | 0

Answered
How do I split one column with 744 rows into 31 columns with 24 values.
A = your column vector result = reshape(A,24,31);

6 years ago | 0

| accepted

Answered
How do I rearrange these matrix values?
A = your matrix result = reshape(A,3,4)'

6 years ago | 0

Answered
Calllib error: Array must be numeric or logical or a pointer to one
This sounds very similar to the following post, where someone was trying to call a function that had a function pointer as one o...

6 years ago | 0

Answered
Matlab Coding for a spacecraft
Thanks for the image post. So, this is a standard orbital proximity operations relative motion question. The equations in your ...

6 years ago | 0

| accepted

Answered
Need help to translate Lat/long as signed 32bit integer to decimal degrees.
The LSB is probably telling you that the value of the Least Significant Bit of the integer value is 1.6764e-07. Since MATLAB al...

6 years ago | 3

| accepted

Answered
Determine Matrix Operation Memory Usage
This is going to depend on the specific operations you are doing, and might also depend on whether any of the variables involved...

6 years ago | 0

Answered
Angle Between two vectors.
This has been discussed many times on this forum. Robust methods are found here: https://www.mathworks.com/matlabcentral/answer...

6 years ago | 1

Answered
Discrepancy Between ODE45 and Solve
For dslove, the sin(w*t) signal gets divided by m, which is 10. For ode45, you don't do this, you just have sin(w*t). ...

6 years ago | 0

Answered
mex file update and compile
The use of mxGetDoubles( ) requires that the code is compiled with R2018a or later, and that you use the '-R2018a' option instea...

6 years ago | 1

| accepted

Answered
MEXW64 runs on 2019A but not 2020A (DLL Issue)
Mex routines are not guaranteed to work across MATLAB versions. Sometimes they do and sometimes they don't. It depends on the ...

6 years ago | 1

| accepted

Answered
Complex number when using variables
Operator precedence >> -50.8478 ^ -1.017 ans = -0.0184 >> (-50.8478) ^ -1.017 ans = -0.0184 + 0.0010i The ^ ope...

6 years ago | 0

Answered
Cutting down time of Length(unique(V1)
If all the numbers are integers mod 43, then just n = zeros(1,43); n(V1+1) = 1; D = sum(n);

6 years ago | 0

Answered
How do I solve the nonlinear power equation?
One strategy: Move del Po to the left side Take ln( ) of both sides Put the ln(beta) and n*ln(del P) on one side and the othe...

6 years ago | 0

| accepted

Answered
Matrix(Matrix)
The "a" values are simply being used as row numbers for indexing into b. b(a(:),:) = b([1;2;1;2],:) which is equivalent to [...

6 years ago | 0

| accepted

Answered
Code not working, velocity comes back the same each time
So here is a version of your code with the following changes: Gravity model replaced with the model found here (also note that ...

6 years ago | 0

Answered
MEX error LNK2019:unresolved symbol
mxGetDoubles( ) is a new API routine that only exists in the R2018a+ API memory model. You have to compile with the -R2018a flag...

6 years ago | 1

Answered
Solve equations of Motion using Matlab ODE45
You will have a 4-element state vector instead of 2. initial_cond = [1;1;0;0]; [t,y] = ode45(@(t,y)ODE_funct_fourth_order(t, y...

6 years ago | 0

| accepted

Answered
increase number of decimals
Just type your format at the command line. E.g., format longg

6 years ago | 0

| accepted

Answered
Comparing orbits between a planet and Red Dwarf
To calculate how often stellar eclipses occur for the 2D geometry, on average, yes all you need to do is look at orbit periods. ...

6 years ago | 0

| accepted

Answered
Multiplying 2 matrices together
Use the matrix multiply operator * without the dot. What you are using is the element-wise multiply operator .* with the dot. Tw...

6 years ago | 0

Answered
Code not working, velocity comes back the same each time
Lines like this are wrong: S(i+1)=S(i)+(V(i)*Tstep+0.5*a(i)*Tstep^2); % Displacement at next i You are double booking the effe...

6 years ago | 0

Answered
strange operation .^ result came out
You are raising -1 to a fractional exponent, so complex numbers will result. Did you mean something like this instead t = 0:10...

6 years ago | 0

| accepted

Answered
matlab digit precision is not correct?
That is just a display artifact. The entire number is still there in memory. Do this to change the display format format longg ...

6 years ago | 0

Load more