Answered
Creating a loop for a Matrix
A=rand(4); [j1,i1] = meshgrid(1:size(A,1)); Out = arrayfun(@(i1,j1)det(A([1:i1-1,i1+1:end],[1:j1-1,j1+1:end])),i1,j1)

15 years ago | 0

Answered
Syntax error of old version ???
write [ignore, board_idx] = min(SCORE);

15 years ago | 1

Answered
matrix manipulation
Use a cell array |Aout| instead of |A1|, |A2| ... A=[1 1 1 5 5 5 5 7 7 7; 1 1 1 5 5 5 5 7 7 7; 2 2 2 9 9 9 9 3 3 3 ; 2 2 2 9 ...

15 years ago | 0

Answered
Help me, please. I want a matrix transform averaged and unique in specific col,
A = [1,2,11; 1,2,12; 1,2,13; 2,4,10; 2,4,12]; [a,b,c] = unique(A(:,1:2),'rows'); out = [a cellfun(@mean,mat2cell(A(:,end...

15 years ago | 1

| accepted

Answered
Storage of a loop from negative number
i1 = -1.5:0.01:1.5; f = @(x,y)92.5+32.53333333*x+40.12702079*y-42.2*x.^2-34.93538288*y.^2-3.464203233*x.*y; Z = bsxfun(...

15 years ago | 1

Answered
Extract multiple matrix from a vector
v = [1 2 3 5 5 0 0 0 0 1 4 2 0 0 5 8 0 0 1 5 8 5 0 0 0]; v1 = v~=0; out = arrayfun(@(x,y)v(x:y),strfind([0 v1],[0 1]),strf...

15 years ago | 1

Answered
how to find minimum point at endpoint in matlab, please help.
f = @(x)((15*x)./(4*x.^2-3*x+4)); xb = [0 10]; x1b = [xb fminbnd(f, xb(1),xb(2))]; [y,yid] = min(f(x1b)); xout...

15 years ago | 1

Answered
symbolic calculation - subs does not work after diff
syms x real A=1; B=2; D=1; C=3; E=A+(B*C^2)./(B^2-x.^2-1i.*C.*x); n=sqrt((sqrt(real(E).^2+imag(E).^2)+real(E...

15 years ago | 0

Answered
what is wrong with fprintf
>> a=rand(4,1) a = 0.67874 0.75774 0.74313 0.39223 >> b = randi(9,4,1) b = 6 ...

15 years ago | 0

| accepted

Answered
fminbnd finding wrong minimum point for no reason, please help
f = @(x)(-(1.0./((x-0.3).^2+0.01)+1.0./((x-0.9).^2+0.04))); x1 = fminbnd(f, -1, 2); x1 y=f(x1); y x = sort([-1:0.3:2...

15 years ago | 1

| accepted

Answered
solve equation without fsolve
a=0.003925; b=0.110361; d=1.492690; R0=100; syms k T cf = coeffs(k-R0*(1+a*(1+d/100)*T-a*d/100^2*T^2+a*b/100^3*T^3-a...

15 years ago | 1

Answered
a simple clasification of matrix elements
idxs = nchoosek(1:4,2) H = sqrt(sum(abs(diff(reshape(p(idxs,:),size(idxs,1),[],2),1,2)).^2,3)); 1. [out1,a,b] = unique(H...

15 years ago | 0

Answered
How to get values that make funtion max
a1 = rand(1,10) b = rand(10,1) a = a1/(a1*b)*50 ablst = [a' b] a*b

15 years ago | 0

Answered
get the value of excel cell using matlab
dat = xlsread('name_your_excel_file'); IndCelOne = find(dat); IndCelZero = find(~dat);

15 years ago | 0

Answered
optimisation of simple equation
% determination of all combinations of values ​​of the vectors a,b,c -> [a(:) b(:) c(:)] [a b c] = meshgrid(1:10,1:2...

15 years ago | 0

Answered
Vectorize loop with function containing randoms
ds = arrayfun(@(i1)containsRandoms(p1),1:max1); %if size of 'ds' m x n eg. 2 x 2 ds = reshape(arrayfun(@(i1)containsRand...

15 years ago | 0

Answered
To remove duplicated matrices in different cell...
c = {[1 2 3 4;5 6 7 8]; [1 1 1 1;1 2 3 4]; [5 6 7 8;2 2 2 2]}; n = cellfun('size',c,1); C = cat(1,c{:}); [~, b] = un...

15 years ago | 0

Answered
how to remove repeating rows from a matrix?(there is a case)
A = perms([0 0 1 1 1]); AB=unique(A(sum(A(:,1:2),2)==1 | sum(A(:,3:end),2)==2,:),'rows'); variant a=[1,1,0,0,0]; b=[1,...

15 years ago | 0

| accepted

Answered
I nedd a hand with this
out = A(ismember(A(:,1:2),B,'rows'),:) OR [lo1,loc] = ismember(A(:,1:2),B,'rows'); out = A(lo1,:); [ignore,idx] = sort...

15 years ago | 1

| accepted

Answered
how to remove repeating rows from a matrix?
unique(A,'rows')

15 years ago | 1

Answered
Conversion to double from sym is not possible
variant with use |Symbolic Toolbox| ( |MATLAB R2010a| ) x = -3:.1:3; syms t Ein = int(3*exp(-t^2),-inf,inf); Eo0 = int(...

15 years ago | 0

| accepted

Answered
smultiplication of matrix element
A = randi(125,5,8); out = A(:,1:2:end).*A(:,2:2:end); variant use loop outc = zeros(5,4); for j1 = 1:size(outc,2) ...

15 years ago | 0

| accepted

Answered
Selecting specific values in a for loop, when a certain condition hold true
for iP = 1:length(vP) Theta = vP(iP); R(iP)= sqrt(abs(C1(iN) - (C2(iN) * cosd(G(iN) + Theta)))); if R(iP) >= Rm...

15 years ago | 0

| accepted

Answered
how to do integration?
Please read help about functions MATLAB: |quad, quad2d, dblquad, quadgk, quadl, quadv, trapz, triplequad,int|

15 years ago | 1

| accepted

Answered
How to find circle from data points
dy = diff(y,2); idx = find(abs(dy) > 1e-10)+1; idc = idx(5)+(0:2:4); id = [x(idc)',y(idc)']; f = @(x,y)(y(:,1)+x(1)).^...

15 years ago | 0

Answered
Adding mirror image of lower triangle of matrix to upper half of matrix
tril(haha,-1)'+haha *ADD* h1 =[ 1 1 0 1 0 0 0 1 0 1 0 1 0 1 0 0 ...

15 years ago | 4

| accepted

Answered
ERROR with type off data
k = single(itmax); for iter=1:k W(iter)=wmax-((wmax-wmin)/k)*iter; ... end or W(iter)=wmax-((wmax-wmin)/sing...

15 years ago | 0

Answered
Vectorization of loop with find
variant sum(bsxfun(@gt,x(:),0:.1:1))

15 years ago | 0

Answered
Durand–Kerner method matlab code help? Anyone can help? Can't figure out what is wrong.
variant c1 - coefficient of input polynom (eg: f(z) = z^3 - 3*z^2 + 3*z - 5; c1 = [1 -3 3 -5]) c1 = c1(:)/c1(1); c = c1(end:...

15 years ago | 0

Answered
Error using mtimes
u=0.6:.1:1.6

15 years ago | 0

Load more