Answered
How to select columns based on a known repeated pattern.
data = raw(:,bsxfun(@plus,29:32,22*(0:floor((size(raw,2)-32)/22))'));

12 years ago | 0

| accepted

Answered
How to calculate average of certain value in a matrix?
Av = mean(A([1:2:end;2:2:end])); or Av = sum(A([1:2:end;2:2:end]))/2; *ADD* n = 3; Av = accumarray(floor((n:n...

12 years ago | 0

| accepted

Answered
How to set all elements in a 2D Matrix between two indices to "1" in each row
cumsum(A,2)>0 & fliplr(cumsum(A(:,end:-1:1),2))>0

12 years ago | 3

Answered
Where is the mistake ?
use |./| instead |/|: u=10:1:100000; d=4225; e=1.917./(4*pi*(10.^-7)*u)+1.326*10.^7;

12 years ago | 0

Answered
How to solve a first and second order coupled differential equations
Try this is code with use Symbolic Toolbox: syms a b c d e x(t) y(t) z = dsolve(diff(x) + x/a == a*y,diff(y,2) + 1/b*dif...

12 years ago | 0

Answered
Avoid loops to make code run faster
data = [0 0 0 0 0 0 735690 26.90 27 0 0 0 0 0 0 735781 28.10 28.20 0 0 0 0 0 0]; out = data;...

12 years ago | 0

| accepted

Answered
how can I draw this loop ?
plot([a,-a],[b,-b]);

12 years ago | 0

Answered
inquiry about a command
a=-5:2:50; n=1:100; X = -sum((-1).^n./n)*a; % EDIT

12 years ago | 0

Answered
Constuctiing special array (like binary)
rem(floor((0:pow2(n)-1)'*pow2(1-n:0)),2)

12 years ago | 1

Answered
Ascending Sort in a cell of file names
b ={'p1-cimg.txt' 'p11-cimg.txt' 'p12-cimg.txt' 'p13-cimg.txt' 'p14-cimg.txt' 'p3-cimg.txt'...

12 years ago | 0

Answered
How can i create a multivariable function from matrix data?
Totalcost= A(:)'*p(:);

12 years ago | 0

Answered
how to allocate elements of a vector into different rows in a matrix, preserving the column order?
Z = zeros(4,2); Z(sub2ind(size(Z),P,1:numel(P))) = X;

12 years ago | 0

| accepted

Answered
How to use str2func to replace eval command?
t = linspace(0.001,2,1000); x_e = 't^3'; y_e = 'exp(t)'; z_e = 'cos(10*t)'; funs = arrayfun(@matlabFunction,sy...

12 years ago | 0

Answered
Replicating values a certain number of times
Jos (10584)'s idea: k = 1959; n = 4; x = floor((0:(k+1)*n-1)/n);

12 years ago | 1

Answered
How to calculate average in a large matrix?
xy = [2 4 4 6 7 1 2 3 4 5 1 2 3 4 5 1 2 4 5 6 2 5 6 8 9 4 7 8 4 9 ...

12 years ago | 1

| accepted

Answered
Sorting data points so x are in ascending order.
[x1,ii]= sort(x); y1 = y(ii);

12 years ago | 2

Answered
How to find first nonzero element/first '1' per row and set other elements to zero without loops in 3D Matrix
s = size(A); out = zeros(s); i2 = s(2) - sum(cumsum(A,2)>0,2) + 1; [ii,kk] = ndgrid(1:s(1),1:s(3)) idx = [ii(:),i2...

12 years ago | 1

| accepted

Answered
Symbolic matrix diagonalization problem
Err = simplify(d1-D); all(Err(:) == 0)

12 years ago | 0

| accepted

Answered
how to access elements from matrix
M = cat(3,a,b,c); ii = 1; jj = 2; out = squeeze(M(ii,jj,:));

12 years ago | 0

Answered
create a matrix with existing matrix
One way: newsize2 = 3600; [i0,j0] = ndgrid(1:size(A,1),1:size(A,2)); F = griddedInterpolant(i0,j0); [io,jo] = ndgr...

12 years ago | 1

Solved


Area of an Isoceles Triangle
An isosceles triangle has equal sides of length x and a base of length y. Find the area, A, of the triangle. <<http://upload...

12 years ago

Answered
How to split a number into 10 different numbers?
a = 50390; b = rand(10,1); b = b/sum(b)*a; out=round(b); out(1) = out(1) - (a-sum(out)); and with using Roger Staf...

12 years ago | 1

Answered
How to use the index of a matrix in another one?
iend = cumsum(counter); ifs = iend - counter + 1; idx = zeros(iend(end),1); idx(ifs) = 1; idx = cumsum(idx); [i...

12 years ago | 0

Answered
Find out the real part of symbolic expression by using MuPad
Re(y0*(y2+I*y0)/(y0+I*y2)) assuming ([y0,y2],Type::Real) or assume([y0,y2],Type::Real); Re(y0*(y2+I*y0)/(y0+I*y...

12 years ago | 0

| accepted

Solved


Swap two numbers
Example Input: a = 10 b = 20 Output a = 20 b = 10

12 years ago

Solved


Is this triangle right-angled?
Given three positive numbers a, b, c, where c is the largest number, return *true* if the triangle with sides a, b and c is righ...

12 years ago

Solved


Find a Pythagorean triple
Given four different positive numbers, a, b, c and d, provided in increasing order: a < b < c < d, find if any three of them com...

12 years ago

Solved


Wrap a vector, but insert NaN's at the wrap-positions.
When you plot a line that wraps, and do not want the sawtooth shape to show up in the plot, you can either draw all separate lin...

12 years ago

Solved


Is this triangle right-angled?
Given any three positive numbers a, b, c, return true if the triangle with sides a, b and c is right-angled. Otherwise, return f...

12 years ago

Load more