Community Profile

# James Tursa

##### Last seen: Today
3,397 2007 年以降の合計貢献数

Interested in external applications, mex & engine applications with Fortran, C, C++, etc, particularly in the areas of speed improvement and memory management efficiencies.

#### James Tursa's バッジ

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

| 採用済み

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

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

1日 前 | 0

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

1日 前 | 0

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

1日 前 | 0

| 採用済み

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

1日 前 | 0

| 採用済み

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

1日 前 | 0

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

1日 前 | 0

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

2日 前 | 0

| 採用済み

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

2日 前 | 0

Multiplication with in a double arrray
M = your 4096x2 double matrix M(:,3) = M(:,1) .* M(:,2);

2日 前 | 1

| 採用済み

matlabs polyfit not working correctly problem
Highest order is first in the p vector. So explicitly this would be pol = p(1)*T_vec.^3 + p(2)*T_vec.^2 + p(3)*T_Vec + p(4) Yo...

2日 前 | 0

| 採用済み

error in using cellfun
This is a limitation of the struct( ) function when fed a cell array. If you examine s you will see it is not what you wanted. ...

3日 前 | 0

| 採用済み

arrange an array(1xn) to (rxc)
Not sure how you want the output ordered. Maybe this A = reshape(m,9,9); or this A = reshape(m,9,9).';

3日 前 | 0

| 採用済み

while loop ends before the question is answered?
Your break is in the wrong place. It should be under one of the if conditions: if user_number==r disp('Nice job you gue...

3日 前 | 1

| 採用済み

Extra independent component in ode integration affects other components
The integrators do not internally step each element separately. They still step the entire state vector as a whole. So even tho...

3日 前 | 0

| 採用済み

ODE 45 not working - not enough input arguments
ode45( ) requires that the derivative function handle have the specific arguments (t,y), where y is a single state vector. But y...

3日 前 | 0

| 採用済み

ode45 - nonscalar
I suppose you could do something like this instead: F{1} = etc. F{2} = etc. F = F'; f = @(X,T)cell2mat(cellfun(@(c)c(X,T),F,...

3日 前 | 0

Column Vector - Nonscalar arrays.
F = @(X, T) [F1(X, T); F2(X, T)];

3日 前 | 1

How to find an explicit function when using Runge-Kutta or one of the pertinent codes in Matlab (ode45)
Symbolic Toolbox doc dsolve https://www.mathworks.com/help/symbolic/dsolve.html

3日 前 | 0

Extracting parts of matrix for sub matrices
E.g., to put them into a cell array mat = your matrix result = mat2cell(mat,repmat(16,8,1),repmat(16,8,1));

3日 前 | 0

Exact probability of a triangular distribution
The exact probability of getting a number greater than the mean is simply the sum of the probabily to the right of the mean. Si...

3日 前 | 1

| 採用済み

I want to rotate a point using Quaternion function
I took a look at this related link: https://github.com/petercorke/robotics-toolbox-matlab/blob/master/Octave/%40Quaternion/Quat...

4日 前 | 1

| 採用済み

Converting sensor frames using Aerospace Toolbox
This discussion on MATLAB quaternion convention might help you: https://www.mathworks.com/matlabcentral/answers/465053-rotation...

4日 前 | 0

Problems with sortrows and str2double, why is it still string?
>> [~,x] = sort(str2double(Respiration_Values)); >> B = Respiration_Labelled(x,:) B = 7×2 string array "139299" "...

4日 前 | 1

| 採用済み

Binary Image: Count number of pixels that are 1.
nnz(bw)

4日 前 | 1

error when running a function
Do not push the green triangle "go" button in the editor since that calls the function without any input arguments. Instead, cal...

4日 前 | 1

solving a set of differential equations with ode45
Initial conditions is a 4-element vector: IC1=[0; 0; 298; 298]; But in your derivative function you have this: M=[5,15,25,55]...

5日 前 | 0

| 採用済み

Loops - physics - nonlinear gravity & acceleration
Your immediate problem is that h is a vector, so the right hand side of this statement is a vector: g(i+1)=(400000000/(6371+h...

5日 前 | 0

Looping over column and returning values where conditions are met
In general, perform find( ) on the condition you want. E.g., find(matrix(:,4)>80) would return the row numbers where the 4th c...

5日 前 | 0