Try setting all of your elements as cells (with the braces) so that you end up with a cell array of strings rather than a character array - your error may have something to do with that because with a character array, if A,B,C, etc. cannot have a different number of elements.
I don't see anything wrong with the way you are doing it. If you want to reduce your two conditions to one condition, you can use absolute value like this:
target = 4; % whatever target you want
tol = 0.002; % whatever tolerance you want
if abs(myVar(i)-target) <= tol
or if you'd like...
How consistent is your input string? I mean, will it always be N=XX_ so that the number your interested in is always between N= and an underscore?
If so, this should work:
%Find the position of 'N='...
NEIndex = findstr('N=',textString);
%Find all of the underscores...
Oh - sorry about that. Have you tried playing with the tolerance? If you relax the default settings on RelTol and AbsTol, maybe it won't require such a small step size.
Other than that I'm not really sure - that might just be the best you can do with the complexity of your system.
Yes - you can set where the tick marks are on an axis:
This will control where the ticks go (use whatever range you want):
(Note that gca returns the handle for the current set of axes)
This will control the labels for the ticks...
You can specify the points for which the solution is found if you give a vector for the tspan argument. So, if you're saying that it's calculating for too many points when you use t = [0 .01], then you can just specify t = (0:.001:.01) or whatever values it is that you want there. I hope that...
Hmm... not sure what's going on. Here's what I did:
- I saved the data you just printed out as a file called 'read.txt'.
- here, I've copied and pasted from my command window:
>> fid = fopen('read.txt')
>> a = fscanf(fid,'%e')
Sure, you can use fminsearch to find where the function is a minimum, but it will not necessarily be a global minimum - fminsearch can get stuck in a local minimum so your answer will depend on your initial conditions. I'm not sure what information I can provide outside of MATLAB's help - I...
You can use logical indexing:
R = rand(ret,len);
X(R<pm) = bitcmp(X(R<pm),1);
or equivalently since I don't think you need to use bitcmp,
R = rand(ret,len);
X(R<pm) = ~X(R<pm);
That overwrites the values of X that have the same indices of the desired values of R.
I may be a little rusty, but I think if you define your state as:
s = [X, dX/dV, T, dT/dV], then you can use ode45 (or any other MATLAB ode solver). (I'm assuming you've used the solvers before and you're just having trouble with this problem.) So your derivative function will look something...
You can use Notepad or any other text editor to write the code. I use WinEdt becase I think it has a nice interface. It's shareware (about $30) that you can download. Other people here might know of better options.
To compile your LaTeX source, you should download MikTex (just look it up...