Answered

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

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

issue with imshow ploting

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

issue with imshow ploting

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

11 years ago | 0

Answered

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

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

Answered

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

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

Answered

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

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

Answered

Explicit solution not found using solve

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

Explicit solution not found using solve

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

Answered

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

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

Answered

Please expalin the error

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

Please expalin the error

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

11 years ago | 1

| accepted

Answered

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

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

Answered

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)

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

Answered

How to use if statements with arrays?

y = (x>2).*(x+1) + (x<=2).*(x-1)

How to use if statements with arrays?

y = (x>2).*(x+1) + (x<=2).*(x-1)

11 years ago | 4

| accepted

Answered

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

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

Answered

How do I stop suppressed commands being printed in the command window?

Try echo off

How do I stop suppressed commands being printed in the command window?

Try echo off

11 years ago | 1

Answered

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

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

Answered

To remove the repeated number

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

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

Deleting a field from a sturcture

Did you save the results of rmfield back to myStruct? myStruct = rmfield(myStruct, myField) Brian

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

Answered

Any way to force Command Window Answers to print Fractions?

Try format rat -Brian

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