Community Profile

Contact

Top 1% contributor

Assuming that the second column of a is always >= the first column of a, then this is an efficient solution. mA = max(a(:));...

accepted

4

Answered 3 years ago

67 downloads

4 years ago

You could probably just differentiate numerically. But if you wanted to do it analytically, that's not so hard either. The coeff...

11231 views

Responded 6 years ago

You could also download it yourself here: <http://www.mathworks.com/products/compiler/mcr/index.html> Version 8.1 correspo...

3

I think there must be a more efficient way to do it, but this at least works. BWDISTGEODESIC starts at a given point, and then c...

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

You can use BITXOR, V = uint16( round(65535*rand(5,1)) ); V2 = bitxor(V,1+2+4); % 1+2+4 = 7 = 0000000000000111 de...

Although I don't recommend programming like this in MATLAB, sometimes writing out the logic out explicitly can make it run extre...

Answered 4 years ago

Given some image, for example (just to make a random image): I = conv2(randn(500),ones(10)) > 10; imshow(I); To keep...

Very ugly, but works: UnsortedText = {'BBB 1'; 'AAA 10'; 'AAA 9'; 'AAA 1'; 'BBB 2'; 'BBB 19'; 'BBB 9'; 'CCC 0'; 'CCC 9' ;...

As mentioned in the links below in Jan Simon's answer, there is the matlab.desktop.editor X = matlab.desktop.editor.getAll ...

Answered 5 years ago

sum(bsxfun(@times,reshape(A,8,[]), 2.^(7:-1:0)'))

Both answers are correct. d/dx[ (x+y)^2/2 ] = d/dx[ x^2/2 + x*y + y^2/2 ] = x + y d/dx[ x^2/2 + x*y ] = x + y The a...

I think you can set a good initial condition and bounds automatically based on the data. Given your desired equation: A+B*(1.0-...

7911 views

Instead of GRIDDATA, I think "scatteredInterpolant" is what you want. This creates an object that you can use to query points fr...

2

Answered 4 months ago

A few observations: 1. A lot of the operations you are doing can me written more efficiently as matrix operations (dot prod...

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

This vectorized solution uses complex exponentials and works about 2 orders of magnitude faster for large vectors. M = exp(...

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

You are forgetting to update v inside your loop. v = sqrt(vx^2 + vy^2); Right now it is sitting at v = 50 the whole time. ...

I think you might be better off grouping your multiplications so that you maximize matrix-vector products instead of matrix-matr...

Here are two possible ideas. Given a circle center and a normal vector: R = 0.25; %Radius xyz = randn(1,3); %Circle cent...

The fastest way to do something generally depends on the size and structure of your data. Don't assume loops are slower. For si...

If the exponent was a scalar, say a=2, then : a = 2; 3^2 = 9 = exp(2 * log(3)) If you define z = 2*log(3), then ...

Maybe something like this? XX=[100.0000 167.3203 359.0253 410.6382 585.7535 716.6290 712.9424 476.9977 364.5553 185.7535 ...

No. But you can specify a "tag" of "32", and then use that to refer to the object using FINDOBJ. For example: figure ...

For one system: sys = rss(3); h = stepplot(sys1); h.Response.Name = 'Bill'; Or multiple systems: sys1 = rss(3...

Use 2-D convolution: I = [ 5 4 3; 9 8 6; 6 3 4;] I_1 = I; I_2 = I; I_1(2:en...

Just for fun, and because it makes for a great example of visualizing spherical data, here is a script to display a spherical...

You're pretty close. Except you don't want to solve 'x^2 + y^2 = 0' You want to solve 'x^2 + y^2 = R^2' --------------...

Load more

Choose your country to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a location from the following list:

See all countries