Community Profile

photo

James Tursa


Last seen: Today Active since 2007

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

Statistics

All
  • Revival Level 3
  • Master
  • Personal Best Downloads Level 3
  • First Review
  • 5-Star Galaxy Level 5
  • First Submission
  • 36 Month Streak
  • Thankful Level 3
  • Knowledgeable Level 5
  • First Answer
  • Solver

View badges

Content Feed

Answered
Increased time for setting elements in sparse matrix
Every time you change the elements of a sparse matrix, MATLAB has to deep copy all the existing elements to a newly allocated ch...

ongeveer 7 uur ago | 1

Answered
How to run a Matlab file which uses functions from .c and .dll files?
It appears that this may be an older mex routine? Is there a "mexFunction" in the c file? If so, maybe you can just recompile it...

6 dagen ago | 1

| accepted

Answered
Unable to perform assignment because the left and right sides have a different number of elements.
Why are you replacing the sin(y-c) term with approximations? Why haven't you just programmed it as is? It appears you have done ...

9 dagen ago | 0

Answered
Applying runge kutta for coupled equations
What are and ? Why don't they have differential equations associated with them? Can you give more details about this? Also, it...

9 dagen ago | 0

| accepted

Answered
How to create a loop on function handle
Isn't this just a standard matrix*vector multiply? E.g., XI = @(xi) xi - (y(i,:) + A*((t(i)+c*dt).*xi)*dt); Note that this fun...

12 dagen ago | 1

| accepted

Answered
Index Matrix A and Matrix B Problems
You can use logical indexing: B(A==1) = 0; You can use a loop for this also, but you would have to show us the code you used b...

12 dagen ago | 1

Answered
Whole derivation of two variable differential function
Please show the code you are using. y' means derivative of y with respect to x, not derivative of y with respect to y. You sho...

13 dagen ago | 0

Answered
How do i compile multiple fortran code from matlab command
To pass variables from MATLAB to your Fortran code you would typically do the following: Write a single gateway routine in a se...

26 dagen ago | 0

Answered
Updating Sparse Matrices every Time-Step Efficiently
To specify the sparse matrix size when creating it, use the following syntax: sparse(I,J,K,m,n) where m is the number of rows ...

26 dagen ago | 0

Answered
how to move a row
result = M([1:400,801,401:800,802])

26 dagen ago | 1

| accepted

Answered
How to set specific size of a figure with exportgraphics?
This doesn't answer your question about controlling exported sizes, but you might be interested in the following export_fig FEX ...

27 dagen ago | 0

Answered
Renaming the variabel while Symbolic to function handle conversion with matlabFunction
You could keep your existing code and create another function handle: funcv = @(A,xdata,ydata)func(A(1),A(2),xdata,ydata)

28 dagen ago | 0

Answered
Making an Array out of another Array if conditions are met
You don't need a for-loop for this. The best way is to use logical indexing. See this link: https://www.mathworks.com/help/matl...

29 dagen ago | 0

| accepted

Answered
How to remove February 29th for leap years in a daily time series over 43 years?
To get rid of the leap days, you can use evenly spaced indexing since the number of days between leap days is constant for your ...

ongeveer een maand ago | 0

Answered
I would like to write a for loop to store all values of y when A=1,2,3,4,5. into a variable y1,y2,y3,y4,y5 respectively. Any help will be greatly appreciated. Thanks
No loop needed, and no need to create multiple variables to hold results. Just use implicit array expansion and hold results in ...

ongeveer een maand ago | 0

| accepted

Answered
Index in position 1 is invalid. Array indices must be positive integers or logical values.
Looks like you changed the definition of what f_m is in your code. In these lines f_m appears to be an array intended to hold va...

ongeveer een maand ago | 1

Answered
What does A(2:4) = [ ] do if A is a 3x3 matrix?
This is linear indexing. Even though the variable is a 2D matrix, MATLAB allows you to index into it using only one index. The l...

ongeveer 2 maanden ago | 1

Answered
error using function code
Create a file called lettergrade.m somewhere on the MATLAB path (e.g., in your working directory) edit lettergrade.m Copy all ...

ongeveer 2 maanden ago | 0

Answered
dynamic naming of structures
Would it be acceptable to use x as a dynamic fieldname instead of the top level variable name? E.g., v.(x).a v.(x).b

ongeveer 2 maanden ago | 1

Answered
How can I define an array of sparse matrix? (both for GPU and CPU)
For CPU, you can use the ndSparse submission by Matt J on the FEX: https://www.mathworks.com/matlabcentral/fileexchange/29832-n...

ongeveer 2 maanden ago | 0

Answered
numerical integration with recursive trapezoid rule
Some issues are immediately apparent. First, you don't reset S=0 inside the while loop. Isn't S supposed to contain only the a...

ongeveer 2 maanden ago | 0

Answered
Store every N columns in a Matrix to a new Matrix
Don't create a bunch of new matrices with hard to use names downstream in your code. Instead, simply reshape your matrix and the...

ongeveer 2 maanden ago | 0

| accepted

Answered
MEX file always crashes when I run it
In the MATLAB code you have this: np=single(np); Then inside the Fortran gateway routine you have this: mwPointer xr, yr, n ...

ongeveer 2 maanden ago | 0

| accepted

Answered
How can I reshape a matrix this way
a=[-0.26,0.23,0.033,0.1,-0.39,0.30;0.30,-0.39,0.10,-0.26,0.03,0.23;-0.03,-0.13,0.16,0.33,-0.16,-0.16] b=[-0.26,0.23,0.033;0.1,-...

2 maanden ago | 0

| accepted

Answered
Matlab while loops with equations
You should probably go through the online tutorials for learning MATLAB. But I will give you an outline to get started: toleran...

2 maanden ago | 0

Answered
i need to find error in code because I it's increasing but it should be decresing
You need to use all the derivatives at the first point to propagate for the initial guess at the second point. I.e., these lines...

2 maanden ago | 0

Answered
t = 2 s, i = √−1, and 𝜔=120π rad/s. Evaluate the following using MATLAB? Hint: exp(n) is used in MATLAB to evaluate en. (a) e−2𝑡𝑐o𝑠 (𝜔𝑡)
I am guessing that the original expression shown is supposed to be interpreted as: Then take the hint at how to evaluate the ...

3 maanden ago | 0

Answered
Why is my projectile motion code only working at certain input angles.
Drag depends on current velocity, not initial velocity. So you need to recalculate V at each step. E.g., Vx = Vx_new; Vy = Vy_...

3 maanden ago | 0

Answered
Sine equation in Euler Method ODE
You've only got one scalar differential equation, so I don't understand why you think you need two variables x and y along with ...

3 maanden ago | 0

Answered
subtract matrix from vector
Just learn how to use indexing and element-wise operators. From your language, here are the pieces: subtract - the first thre...

3 maanden ago | 0

| accepted

Load more