Community Profile

photo

James Tursa


Last seen: Today
3,287 total contributions 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.

Contact

James Tursa's Badges

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

View details...

Contributions in
View by

Answered
Problems activating license MATLAB R2013a or R2013b versions.
This is a user forum. For official TMW help on installation and licensing, contact them directly. Click on the "phone" icon at...

1 day ago | 0

Answered
How to convert a sign integer matrix to binary?
Reshaping is fast since it uses a shared data copy instead of a deep data copy. So your three step process isn't going to be sl...

1 day ago | 0

| accepted

Answered
Array indices must be positive integers or logical values.
These lines: L = charpath(D); Lrand = charpath(Drand); clust = meanC/meanCrand; charpath = L/Lrand; look li...

2 days ago | 0

Answered
Matrix dimensions must agree
Yes, you need . in other places. Basically, to do element-wise operations you need to look for all of the x's in your equation ...

2 days ago | 0

Answered
Plot x^2+y^2=4
E.g., since you know it is a circle with radius 2 centered at the origin; ang = 0:0.01:2*pi; x = 2*cos(ang); y = 2*sin(ang); ...

2 days ago | 1

Answered
Matrix n x n with n is integer
Examples, If N is a 5x7 matrix and n is 3, then your function would return N(1:3,5:7), the 3x3 sub-matrix at the top right cor...

2 days ago | 0

Answered
How to solve a second order differential equations with matrices by using "ODE45"?
1/m is a scalar/3x3 hence the error. Normally I would advise backslash here, but that brings up another issue. If M, C, and K ...

3 days ago | 2

Answered
Image read in MATLAB and C
An int is likely 4 bytes on your machine, not 2 bytes. Also the expression "order" by itself evaluates as a pointer to the firs...

7 days ago | 0

Answered
Appending a row vector into a matrix based on given conditions
x = abs(b-60) > abs(b-550); % fixed typo xzplane550 = equakemat(x,:); xzplane60 = equakemat(~x,:); If all the data ends up in...

8 days ago | 0

| accepted

Answered
Is it a mistake that the function sum?
Welcome to the world of floating point arithmetic. https://www.mathworks.com/matlabcentral/answers/57444-faq-why-is-0-3-0-2-0-1...

9 days ago | 1

Answered
return any angle to (0 to 2pi) range
The short answer: mod(x,2*pi) The long answer for this particular mod operation, is that if you want to get the same answer fo...

9 days ago | 0

| accepted

Answered
Precision quandaries: why can I print 64 digits?
What you describe sounds like it is just a display issue. Earlier versions of MATLAB on PC machines used a library print functi...

9 days ago | 0

| accepted

Answered
Grabbing number from array to calculate the numerical derivative
For the version you post, see the diff( ) function along with element-wise divide. E.g., diff(y) ./ diff(x) If that doesn't wo...

10 days ago | 0

| accepted

Answered
Coding a quadratic root finder
I would advise having your logic figure out what situation you have before you start solving things. E.g., something like if( a...

11 days ago | 0

Answered
Numerical solution of ODEs system using ODE45
You've got a 2nd order DE and a 3rd order DE, so the order of your system is 2+3=5, not 6. So your state vector should have 5 e...

11 days ago | 1

Answered
Am I doing this right? (a Math formula to Matlab language)
You are on the right track, but have typos in the code due to parentheses issues. A = sum( (x - y).^2 ); B = sum( (x - mean(x)...

12 days ago | 1

| accepted

Answered
Numerical solution of Higher order differential equation using ODE45 and a m. archice
t is a number, not a symbol. So u = sin(t) is a number, not a symbolic function. So doing diff(u) does diff on a single value,...

12 days ago | 0

| accepted

Answered
Write an executable script file (m-file) that takes no inputs and returns the displacement and stored energy of a spring system after prompting the user for the 1) input forces (in N) on the spring and 2) the spring constant (in N/m).
To get you started, simply create an m-file with something like this at the front end: F = input('Input the force on the spring...

14 days ago | 0

| accepted

Answered
How can I add 1 to a particular element in a matrix?
M = your 13x13 matrix M(1,2) = M(1,2) + 1;

15 days ago | 0

| accepted

Answered
How to determine Simplex using Nelder-Mead Algorithm in all direction?
The Nelder-Mead Simplex Method is an adaptive method that adjusts the lengths and directions dynamically. The vertices could be ...

15 days ago | 0

Answered
Question on why tilde cannot return the opposite statement result
Precedence of ~ is hgher than >, so it gets performed first. You need to use parentheses: ~(adultdata.age>50)

16 days ago | 0

| accepted

Answered
A single column vector or an array, which is faster?
Other things you are doing in your code are likely to dominate run times. We would need to see your particular application to of...

16 days ago | 0

| accepted

Answered
Matrices and indexing ?!
[LX,LY] = ndgrid(Lx,Ly); z = LX(:)./LY(:) <= 2; LX = LX(z); LY = LY(z); LX and LY contain the number pairs that match the co...

17 days ago | 0

Answered
Sort rows of matrix by matching column with another matrix column
E.g., assuming everything in column 31 has a match [~,x] = ismember(A(:,31),B(:,31)); Bsort = B(x,:);

17 days ago | 1

| accepted

Answered
how to find max value of a function with a for loop
Make e a vector. E.g., for i=1:length(x) e(i) = y(i) - (m*x(i)-b); % <-- Are you sure that isn't supposed to be (m*x(i) +...

17 days ago | 1

| accepted

Answered
How to solve a system of ODEs and plot the result
This is where you needed to show us the complete code and the complete error message. It is probably complaining about your init...

17 days ago | 0

| accepted

Answered
precision of calculation with Matlab
Calculators may not use the same floating point representations or arithmetic routines that MATLAB uses, so differences in the t...

17 days ago | 0

Answered
How to code for this equation in Matlab
Assuming that f(x) is really supposed to be f(t): f = @(t)exp(j*w*t); But, you will need to have w defined prior to this.

17 days ago | 0

| accepted

Answered
Mex C file generation Linker library error
Do you already have a zzz.lib file? Normally to get your mexFunction code to link to the library you simply include it as part ...

17 days ago | 0

| accepted

Load more