Réponse apportée
Plotting heaviside unit step functions
If you replace the line with the heavisides in it with the one from my previous answer dydt(2) = (A*t >= 0) + 4*(A*(t-1) >=...

plus de 14 ans il y a | 1

| A accepté

Réponse apportée
Plotting heaviside unit step functions
heaviside is a function from the symbolic toolbox - I'd be surprised your code doesn't complain when you try to call it. Why ...

plus de 14 ans il y a | 0

Réponse apportée
Economical use of memory
Matlab's semantics are pass-by-value but it only actually copies the matrix if you modify it within your function, "lazy copy" o...

plus de 14 ans il y a | 0

Réponse apportée
Why do you come to "MATLAB Answers"?
When I get blocked with my research, here at least I can make an epsilon contribution to something ...

plus de 14 ans il y a | 1

Réponse apportée
Why not use square brackets?
OK, I looked into this a little more rigorously. I thought I'd test James Tursa's suggestion from my previous answer to see if t...

plus de 14 ans il y a | 3

Réponse apportée
Why not use square brackets?
A quick test reveals that there is a small cost to including them tic for i = 1:1000000 A = [1:100]; end t1...

plus de 14 ans il y a | 1

Réponse apportée
??? Subscript indices must either be real positive integers or logicals. Using findpeaks
You've probably declared a variable called findpeaks by accident. Try which findpeaks and confirm it's actually pointin...

plus de 14 ans il y a | 1

Réponse apportée
MATLAB in unexpected places
On an episode of Harry's law (I can't remember which one), Tommy Jefferson (a fast-talking lawyer) boasts about a number of laws...

plus de 14 ans il y a | 0

Réponse apportée
matlab function
Why not just [M, N] = find(I, 1, 'first') ?

plus de 14 ans il y a | 0

Réponse apportée
Surface area from a z-matrix
If your data is smooth enough (assuming that's what you're after), then there is a really quick way to work out approximately th...

plus de 14 ans il y a | 1

Réponse apportée
Need help with newton's theorem (matlab)
It works fine - you're just using a (contrived!) nasty example. Plot your function between -3 and 20 and see where the first New...

plus de 14 ans il y a | 1

| A accepté

Réponse apportée
Lagrange Multipliers
This is not a Matlab question, it's a calculus homework problem. Define a function f(x,y) that you want to minimise, a constrain...

plus de 14 ans il y a | 0

Réponse apportée
data fitting starting from a coupled system of differential equations
Hi Simona. I'm adding this as a new answer so that I can use code markup. You need a function that takes in K1, K2, K3 as inputs...

plus de 14 ans il y a | 0

Réponse apportée
plotting unit step function
Or as an anonymous function: f = @(t) (t > 1) - (t > 2) + (t < 2) - (t < 3) + (t > 3) - (t > 4); t = linspace(-5, 5, 200...

plus de 14 ans il y a | 0

Réponse apportée
How to create a solid spherical cluster with random distribution of points
Here's the lazy (no thinking, no maths) way. It will be slow(ish), but serves to illustrate the idea. I'm sure you can think up ...

plus de 14 ans il y a | 1

Réponse apportée
Handles: How do They Work?
The easiest way to do this is to define a constructor function that passes out a handle to be used in the ode solver by using ne...

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
Max / Min of sparse matrices
*EDIT* There was a mistake in the markers line and the s= line, fixed now. OK, here's an accelerated version. What made my pr...

plus de 14 ans il y a | 1

| A accepté

Réponse apportée
Max / Min of sparse matrices
Can't do this one quite so cutely :) Try this (for rows), you can do the same thing for columns with a trivial modification ...

plus de 14 ans il y a | 0

Réponse apportée
Can I use quadprog when equality constraint matrix is not full rank?
If your equality constraint matrix is not full rank, then either your equality constraints are consistent, and dependent, or the...

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
Max/Min of nonzero rows/cols
B = A; B(B == 0) = NaN; colMax = max(B); colMin = min(B); rowMax = max(B, [], 2); rowMin = min(B, [], 2); ...

plus de 14 ans il y a | 2

| A accepté

Réponse apportée
cell comparison with other cells in different rows
For the record, it would be better to use arrays rather than cell arrays for the coordinates (in fact for the whole thing, but t...

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
Non negligeable imaginary number after ifft even when hermitian symmetry is kept.
When you do your flipdim, shouldn't you be taking the complex conjugate also?

plus de 14 ans il y a | 1

Réponse apportée
Find element in matrix
Here's a slightly uglier way that will work. If you need the code to perform quickly, you'd obviously preallocate your arrays m ...

plus de 14 ans il y a | 1

| A accepté

Réponse apportée
sum of series
I think you may need to try and ask your question more clearly. What you've written there reduces to 1 + 2 + 3 + ... If it's ...

plus de 14 ans il y a | 0

Réponse apportée
maximum position of element in a matrix
Pretty straightforward - the only complicating factor is that max only works down one dimension at a time, so you either have to...

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
handles to subfunctions?
From <http://www.mathworks.com/help/techdoc/matlab_env/f9-6232.html> The report does not list: ... Files called from ...

plus de 14 ans il y a | 2

Réponse apportée
How to control number of threads in FFT ?
I just tried it out on my Windows install (R2011b). No matter what you set maxNumCompThreads to, fftn only ever uses one thread....

plus de 14 ans il y a | 0

Réponse apportée
robot
<http://petercorke.com/Robotics_Toolbox.html>

plus de 14 ans il y a | 1

Réponse apportée
Get Feature from an image and match it from another image
There are lots of algorithms that do this. Try google for * SIFT * SUSAN * NCC * Harris etc. etc. There are many Matla...

plus de 14 ans il y a | 0

Réponse apportée
Affine transformation that takes a given, known ellipse and maps it to a circle with diameter equal to the major axis.
I'm writing this down as a new answer so I can get markup for the code snippets. Let's work with the first blob from regionprops...

plus de 14 ans il y a | 3

| A accepté

Charger plus