Warning: Matrix is singular to working precision. Help?
Do you want array division when you write (u0*I*y)/(2*pi*rplus) and similar expressions? If so, then you need to use ...

11 years ago | 1

| accepted

Index must be a positive integer or logical. Very simple program.
You cannot use the same name for a function and for its output argument. Try function [val]=f(x) val=((x^5...

11 years ago | 0

| accepted

Abs and angle of complex number with symbolic object
Well, for part 1 you have to assume a is a non-negative real: syms a assume(a>0) Then >> abs(a) ans = a I ha...

11 years ago | 0

adding rows somewhere in the array
Then, when you want to build the complete |LOCATION| matrix, you can do something like LOCATION2 = zeros(15, 4); LOCATION2...

11 years ago | 1

| accepted

adding rows somewhere in the array
Do you mean that you simply want to find which numbers are missing from |frame_num|? You can do that with missing_nums = set...

11 years ago | 1

how do i solve this non linear system?
|fsolve| will only pass in a single argument, so |i| will be undefined. Assuming you want to solve this equation for fixed value...

11 years ago | 0

| accepted

issue with imshow ploting
It is probably a scaling issue. What are the sizes of |image| and |phi|?

11 years ago | 0

How to pause the code?
If you only want to pause when specific conditions are satisfied, you can put the |pause| or |keyboard| statement inside an if c...

11 years ago | 0

| accepted

Problem with my Callback function or handles values
You need to save |handles| back to the figure after each call, as in: handles.STANumber = handles.STAumber + 1; guidat...

11 years ago | 0

issues with function find()
Try tr=0:.1:20; tr = round(tr*1e12)/1e12; b=find(tr==2.4) This is a problem with finite precision. See the explana...

11 years ago | 0

I know nothing about mimicking portfolios, but I do know that anything you assign to |thetaa| is lost when you call syms the...

11 years ago | 0

| accepted

How can I multiply matrix of vectors by matrix?
Not without loops, but hiding them inside bsxfun... M = rand(140,160,3); % image data T = randn(3); % transformatio...

11 years ago | 0

The documentation for |struc| indicates that it takes three input arguments: >>help struc struc Generate typical struc...

11 years ago | 1

| accepted

Changing the default tolerance for fmincon
You can pass an options structure to |fmincon|. You create the structure using <http://www.mathworks.com/help/matlab/ref/optimse...

11 years ago | 1

how to evaluate a symbolic function in matlab
syms x func=cos((pi*x)^4); RHS=diff(func,x,2); xx=-1:0.1:1; d2f = subs(RHS, xx)

11 years ago | 0

How to use if statements with arrays?
y = (x>2).*(x+1) + (x<=2).*(x-1)

11 years ago | 4

| accepted

how to save a file in ".m" format using command
You should not save data in an m-file; a mat-file is the best way. I believe the problem is how you are loading the data. If you...

11 years ago | 0

Error: Unbalanced or unexpected parantheses
You cannot use indexing in the arguments listed in the function definition. Try instead: function [u,w] = velocity(H,sigma,k...

11 years ago | 1

| accepted

To remove the repeated number
Use unique([1 2 2 2 3 4 5]) Note that this will also sort the elements. -B

11 years ago | 1

Simulating events of varying duration
This seems to be what you are looking for: onset=[23 40 67 88] duration=[3 9 2 6] all=cell2mat(arrayfun(@(a,b)a+(1:b)-1,...

11 years ago | 1

Floating point numeric display vs engineering / exponential notation
The format in which the numbers are printed is not affected by the source (in this case, a CSV file). That is, as long as you re...

11 years ago | 0

how to find lambda from this formula?
|e = eig(A)| returns a vector of eigenvalues of the matrix |A|. To get the associated eigenvectors, use |[V,D] = eig(A)|. See th...

11 years ago | 0

| accepted

Deleting a field from a sturcture
Did you save the results of rmfield back to myStruct? myStruct = rmfield(myStruct, myField) Brian

11 years ago | 0

| accepted

Any way to force Command Window Answers to print Fractions?
Try format rat -Brian

11 years ago | 1

| accepted

Question

Why does Stateflow evaluate the condition [x >= (1/2)] differently from [x >= 0.5]?
I have created a minimal example (available here: <http://dl.dropbox.com/u/99981625/fraction_in_condition.mdl>) consisting of a ...

11 years ago | 1 answer | 1