Risposto
Efficiently multiplying diagonal and general matrices
The best solution is going to depend on what your m and n actually are (if you know representative values of them, you should in...

oltre 10 anni fa | 1

| accettato

Risposto
Efficiently multiplying diagonal and general matrices
M = randn(10000,10); D = diag(randn(10000,1).^2); tic A = M'*D*M; toc tic B = bsxfun(@times,M,sqrt(dia...

oltre 10 anni fa | 0

Risposto
diagonal pixel differences of image matrix
b = [2 1 8 24;9 10 3 12;2 5 8 19;1 2 3 4]; conv2(b,[-1 0; 0 1],'valid')

oltre 10 anni fa | 1

Risposto
ODE with diff? DE in x(t), w/ forcing y(t), where y'(t) also appears.
It might seem counterintuitive, but even though y'(t) appears in the ODE, you don't actually need to calculate it. No DIFF, no G...

oltre 10 anni fa | 1

Risposto
The advantages of MATLAB over other programing languges for Image Processing
I'm sure I've left a bunch of stuff off this list, but this is what I got off the top of my head. * A very large (and growing...

quasi 11 anni fa | 2

Risposto
minimum row value and return the row
Do you mean to say, you want the row with the minimum maximum value? A=[12 64 76; 34 10 27; 9 8 20; 10 30 8]; [value,ind...

quasi 11 anni fa | 2

| accettato

Risposto
Generate Y from the conditional f(y|x)
If your goal is to generate points with that 3-dimensional PDF, then I think it could be done a bit simpler without having to do...

quasi 11 anni fa | 1

| accettato

Risposto
Why isn't the autocorrelation of rand a delta function?
As described in detail here, <http://en.wikipedia.org/wiki/Autocorrelation>, there is more than one convention when calculating ...

quasi 11 anni fa | 1

| accettato

Risposto
Splitting an axis into a linear and log scale
I don't think there's an easy way to do it, but you might be able to piece together two axes to make it look like its half linea...

quasi 11 anni fa | 4

| accettato

Risposto
Finding vertices of (large) linear program feasible region
For the k-th direction, the set of possible edge points is b./A(:,k) along with +/-Inf. So test each one in order to see if it i...

quasi 11 anni fa | 0

| accettato

Risposto
Integral with scalar input
For an integrand that can't accept vector inputs, but only take scalar values one by one, you actually need to set ArrayValued t...

quasi 11 anni fa | 1

| accettato

Risposto
In MATLAB (cumulative distribution function), how can I find the corresponding data point (Y) for any chosen cumulative probability?
Alternatively, you can use ICDF directly on the probability distribution object icdf(pd,[0.2 0.466])

quasi 11 anni fa | 0

| accettato

Risposto
Nesting parentheses issue: any workaround?
I am in agreement with Jan. I cannot recall a single instance where I needed to use 32 parenthesis for anything. If you really n...

quasi 11 anni fa | 0

Risposto
Fit a piece-wise linear function to data: fitting 2 lines to data and finding their corresponding parameters
You data doesn't really look like it has a constant trend at the beginning. In any case, you should still be able to solve it wi...

quasi 11 anni fa | 0

| accettato

Risposto
Find row in matrix, fast and with special conditions
Not sure if this is faster, but might be worth a try. d1 = 12650; d2 = 4; S = randn(d1,d2); s = S(randi(d1),:); ...

quasi 11 anni fa | 0

Risposto
multiplication table in matlab
N = 10 (1:N)'*(1:N)

quasi 11 anni fa | 4

Risposto
How to calculate the cumulative value by consequetive hours
data = [1 2 3 4 5 6 7 8]; for n = 2:5 conv(data,ones(1,n),'valid') end This gives me: ans = 3 ...

quasi 11 anni fa | 1

Risposto
Perfect random numbers - How can I refine an initial dataset from randn to be perfrectly normal?
If you want to generate a set of numbers that "looks random", has 0 mean, 1 variance, 0 skewness, 3 kurtosis, you can start with...

quasi 11 anni fa | 2

Risposto
L1 Optimization in matlab
Make some d and F just to test it. d = [1;2;3;4;5]; F = [.1 .3 .5 .7 .9; .2 .4 .6 .8 1.0]; I can think of two ways. ...

quasi 11 anni fa | 0

| accettato

Risposto
how can we represent the histogram of a vector without using the hist function ?
Is it that you just don't want the bar graph that comes up with HIST? If you call it with output arguments, you can get the valu...

quasi 11 anni fa | 0

Risposto
Taking weighted means over matrices with missing data
M = [4 NaN 1 NaN; 5 3 8 NaN; 1 6 2 4; 8 4 7 2]; w = [0.4 0.3 0.2 0.1]; W = bsxfun(@times,~isnan(M),w); W = bsxfun(@...

quasi 11 anni fa | 0

Risposto
Get rid of nested for loops?
A few observations: 1. A lot of the operations you are doing can me written more efficiently as matrix operations (dot prod...

quasi 11 anni fa | 4

| accettato

Risposto
How to find zero elements in a three dimensional matrix whose neighbors are all zero.
As you guessed, there are much simpler ways to do it using image processing techniques. % Just making some random data to w...

quasi 11 anni fa | 0

| accettato

Risposto
Intersection of Two Implicit Curves over a domain
This sort of problem can be solved easily using FSOLVE circ = @(x,y) x^2+y^2-4 elp = @(x,y) ((x-2))^2+((y+2)/4)^2-1 ...

quasi 11 anni fa | 0

| accettato

Risposto
while loop in matlab password GUI
In your GUI case, the reason it displays 'a' after just one failed attempt is, this loop: username1= 'xxx'; password1= '...

quasi 11 anni fa | 0

Risposto
How to calculate conditional sum of a part of vector/array based on a 2nd one
Just for comparison, here is a FOR loop solution. FOR loops can actually be very fast, even for large arrays, especially when yo...

quasi 11 anni fa | 1

| accettato

Risposto
Negative gain and phase margin, yet a stable and robust system... can somebody explain?
When I try that, I get something completely different. How are you defining your P and C? s = tf('s'); P= 1.429e-07*1/(s...

circa 11 anni fa | 1

| accettato

Risposto
How to create a boxplot from a PDF?
How about something like this. Generate the CDF from your data as Tom suggested, invert it, use the inverted CDF to generate a ...

circa 11 anni fa | 1

| accettato

Risposto
Values of intersection points of plot. Print results.
If your x is the output of an ODE solver, then it might not hit x2 = 1 exactly and you will need to interpolate. You could us...

circa 11 anni fa | 3

| accettato

Risposto
Large Sparse Matrix Summation
This seems to work well: % Making some random data... N = 1000; K = 100; A = sprand(N*K,N,0.0001); [r,c,val...

circa 11 anni fa | 2

| accettato

Carica altro