Answered
Variable called angle (name conflict)
I can think of two immediate ways to deal with this. But, as you've pointed out, it is of course best not to mix variable and fu...

13 years ago | 1

| accepted

Answered
Output numbers, but WITHOUT a new line.
What you describe is not entirely impossible, tic while toc < 3 S = sprintf('x = %f\ny = %f',rand,rand); ...

13 years ago | 2

Answered
how to calculate the maximum of different parts of a vector without using a for loop?
Although I don't recommend programming like this in MATLAB, sometimes writing out the logic out explicitly can make it run extre...

13 years ago | 3

| accepted

Answered
bwdist feature transform output is wrong class and imprecise?
After checking on this, you're right. In R2010b, it was returning IDX as a single, and because a single can only represent conse...

13 years ago | 0

| accepted

Answered
how to determine the best tangential at every points from a freehand line?
The SMOOTH function from the Curve Fitting Toolbox might help. This seems to work well for me: h = imfreehand('Closed',fals...

13 years ago | 1

Answered
How to solve multiple ODEs to fit empirical observations by optimizing multiple constants?
Below is an example that does exactly what you are describing. Save it into a file and run it. First I just made some sample dat...

13 years ago | 0

| accepted

Answered
removing objects which have area greater and lesser than some threshold areas and extracting only the objects which have the area in between
Given some image, for example (just to make a random image): I = conv2(randn(500),ones(10)) > 10; imshow(I); To keep...

13 years ago | 5

| accepted

Answered
Improve computation speed of function
Your function is a convolution. I think it could be written more simply like this: function output=del2_83(input,dx) K...

13 years ago | 3

Answered
Binary matrix incrementer speed
You should be able to do it faster by calculating the matrices all at once and storing the result, instead of doing it one by on...

13 years ago | 2

Answered
curve fitting with numeric array instead of analytic form for function of x
If I understand you correctly, then I think all you need is the "backslash" operator. Just like this: x = (0:0.1:10)'; ...

13 years ago | 1

Answered
Faster method for polyfit along 3rd dimension of a large 3D matrix?
This can be accomplished in a fraction of the time with some matrix operations. dataCube = rand(100,100,300); sizeCube ...

13 years ago | 7

| accepted

Answered
Counting the neighbors in matrix
R = randi([0 7],100); % Input H = zeros(8); % The 8x8 Matrix for k = 0:7 C = conv2(double(R == k),[1 1 1; 1 0 1...

13 years ago | 1

Answered
AQB+CQD=E - how to solve for Q?
Just making some test data... A = randn(12,6); B = randn(6,12); C = randn(12,6); D = randn(6,12); Q_true = diag...

13 years ago | 0

| accepted

Answered
Run a simulink model for a certain amount of time and pause
If you know the times that you want to stop and restart it at, could you maybe use the SimState to resume the simulation, someth...

13 years ago | 2

| accepted

Answered
How to solve an equation of motion with the ode solver when the spring constant is dependent on the position of the solution of the equation of motion
There is absolutely no problem in using MATLAB's ODE solvers to solve a problem like this. Say for example k(x) = 1+x^2 T...

13 years ago | 1

| accepted

Answered
Circular indexing of an array
X = 1:10; ifft(fft(X).*fft([1 1]/2,numel(X)))

13 years ago | 1

Answered
Get numeric handle of imline, impoint etc hggroup
One way to do it: h = imline; numeric_handle = findobj(h,'-depth',0)

13 years ago | 0

| accepted

Answered
Problem using ind2rgb and CDataMapping
You need to call IND2RGB with a colormap that is as big as your data. Something like this: M = round(5000*rand(300,300)); ...

13 years ago | 0

| accepted

Answered
plot 3D curve with color-coded direction
Yes, you can do this in MATLAB. But it is easier to use a "surface" (in this case, I am calling MESH) to plot it instead of a li...

13 years ago | 3

| accepted

Answered
how to get a integral vector result very fast with the upper limits which are supplied in an array?
Using ODE45 to do the integration might be faster than using quad, particularly if your x is large: tempFunction = @(tVari...

13 years ago | 4

Answered
Creating masks of open lines with imfreehand and impoly ROI tools
If I understand you correclty, you want to create an image of the line, without closing the curve. That's certainly doable. ...

13 years ago | 1

| accepted

Answered
How to vectorize this loop ?
You are calling regress with two vectors. That is the same as a projection using the dot product. So then your code could be wri...

13 years ago | 0

| accepted

Answered
How can I create a matrix where every combination of numbers between 0 and 1 (step x) is used and every row sums to one?
I like andrei's method, but it will will run out of memory quickly when step is small! Here is a better implementation of the...

13 years ago | 1

Answered
How to pick n random points on a sphere
I also do not understand what you mean by connecting 4 points on a sphere, but to answer the first part of your question, th...

13 years ago | 2

Answered
Non Linear Fit help?
"How do you go from log10 parameters to estimating the error in the parameter itself using COVB??" It's very easy, you just u...

13 years ago | 0

Answered
Non Linear Fit help?
Ah! Sorry sorry sorry. There's actually a MUCH easier way to make all of this work. The important point is to set the model equ...

13 years ago | 0

Answered
Non Linear Fit help?
This problem is clearly difficult. It has multiple minima, and a strong dependence on initial conditions. Instead of NLINFIT, I ...

13 years ago | 0

Answered
calculate the correlation of a number of time series
diag( corr( bsxfun(@minus, sum(data,2), data), data) )

13 years ago | 0

Answered
Evaluate advanced integral numerically
Ah, ok. Then you'll have to do it the hard way, like this: myquad = @(fun,a,b,tol,trace,varargin)quadgk(@(x)fun(x,varargin{...

13 years ago | 0

Answered
Evaluate advanced integral numerically
This integral can be calculated in MATLAB. The integrand as written in your link is: J = @(x,y,z,f) sqrt(x.^2+y.^2)./sqrt...

13 years ago | 2

| accepted

Load more