Answered
mean value of a particular portion of a matrix
variant mean(A(B==2));

15 years ago | 1

| accepted

Answered
Problem in function
so? function [penalty] = calcpenalty(x) r3penalty=0; r2penalty=0; r1penalty=0; penalty=zeros(size(x,1),1); for ii =...

15 years ago | 0

Answered
Sorting Algorithm
more variant Array1 = [3,-1,-34,10,8]; Array2 = [2,-9,4,-5,0]; A = [Array1;Array2]; SortedArray = []; while ~isempty(...

15 years ago | 1

Answered
help in dsolve
so? x = dsolve('2*Dw-w=2*t^2+1','w(0)= -1/3','t'); fff = eval(['@(t)' vectorize(x)]);

15 years ago | 0

| accepted

Answered
Is it possible to replace ranges of a matrix elements using indices from two vectors?
more variant indcol = ones(5,1)*(1:5); X = +(a(:,ones(5,1))<=indcol & b(:,ones(5,1))>=indcol) and C = arrayfun(@(x,y,z)...

15 years ago | 2

Answered
Using "for" and "fsolve"
can so ... W = zeros(14,1); Y = zeros(14,1); x0 = [0.2; 0.25]*ones(1,14); for i = 1:14 tau = dataApr11(i,3); ...

15 years ago | 0

| accepted

Answered
arrange the values in an array
in Excel xlswrite('namexls',cellfun(@(x)num2str(x.'), mat2cell(A,5*ones(size(A,1)/5,1),ones(1,size(A,2))),'UniformOutput' ,...

15 years ago | 0

| accepted

Answered
construction of a matrix
this cycle is not needed T = Ac >= Ac_estm; % T is logical class T = +(Ac >= Ac_estm); % T is double but with loop ...

15 years ago | 0

| accepted

Answered
Checking if a matrix has all its elements filled with one or not?
variant all(x)

15 years ago | 2

| accepted

Answered
number of elements
variant the full solutions A = randi([1 5], 1483,417); m = 92; mn = fix(size(A)/m); Awork = A(1:mn(1)*m,1:mn(2)*m); ...

15 years ago | 0

Answered
Maple piecewise to MATLAB
variant function y = resultmatlab(t,tb,tr,ii) p = t(:); y = zeros(size(p)); t1 = p<=tb; y(t1) = 0; t2 = p > tb ...

15 years ago | 0

| accepted

Answered
assign a vector
variant with loop with example Ac = randi(100,[1 5 2 2]); D = zeros(3,3,2,2,2,2) for k=1:K for m=1:M ...

15 years ago | 1

| accepted

Answered
converting matrix to string
can so data = {'e' 5985; 'e' 498598}; A = num2str(data{2,2})

15 years ago | 0

| accepted

Answered
for loop
variant without loop delta = d*Ac; t = T==0; R = Ac - Ac_estm; R1 = R + delta; R2 = R - delta; t1 = sign(R1) <= 0...

15 years ago | 0

| accepted

Answered
too many output arguments
variant with _linprog_ f = [-5,-7]; A = [3, 4; 2, 3]; b = [15; 12]; x = linprog(f,A,b);

15 years ago | 0

| accepted

Answered
How to choose the real root in z^3
variant 1 x = sym('x','real'); % or: syms x real xreal = solve(x^3-8,x) variant 2 x = sym('x','unreal'); % or: s...

15 years ago | 0

Answered
dimensionality problem with differential equations
variant I'm sorry I made a T1 variable: t = T1 dvgl = @(t,y,omega,k,I2)[y(2); 1./I2*((omega1./y(2)).*t-k.*y(1))]; k = 12.6...

15 years ago | 1

| accepted

Answered
search number in a text file
variant Your text in the file 'yourtxt.txt' strc = textscan(fopen('yourtxt.txt'),'%c'); s1 = regexp(strc{:}', '[0-9]*','ma...

15 years ago | 0

Answered
system of eqns 2 solve. Help please
doc solve r1 = z.r1 r2 = z.r2

15 years ago | 0

| accepted

Answered
matrix, window finding median....
variant (as in medfilt2) x = randi(125,3);% input array x = sort(x(:)); I = numel(x)/2; if rem(I,1), y = x(ceil(I));...

15 years ago | 0

Answered
call array to vectors using a for loop error problem
Dir = zeros(size(Spt{1},1),length(Spt)); for n=1:length(Spt); Dir(:,n)=Spt{n}(:,3); end or Dir = cell2mat(cellfun(@...

15 years ago | 1

Answered
How to extract peaks from a matrix and concatenate columns with different number of rows using a loop?
variant of using cellfun M = randi(1500,12,12); [p,l] = arrayfun(@(x)findpeaks(M(:,x)),1:size(M,2),'UniformOutput',false); ie...

15 years ago | 1

| accepted

Answered
multiple matrix manipulation with different size matrices
variant [m1 n1] = size(B); [m2 n2] = size(A); Y = reshape(B,m1,n2,[]); Y1 = permute(Y,[2 1 3]); Y2 = reshape(Y1...

15 years ago | 1

Answered
Efficient way to fill vector values from another vector
old variant p=flipud(inputSignal); p1 = flipud(inputTargets); ne = diff(find(diff([~p(1); p(:); ~p(end)]))); %idea by Wa...

15 years ago | 0

Answered
Take specific element value in a matrix
example A = randi(160,4) A1row = num2cell(A(1,:)) [V1, D1, V2, D2] = A1row{:} or V1 = A1(1,1), D1 = A1(1,2), V2 = A1(...

15 years ago | 0

Answered
using nested for loops
most unwise variant function C = yourmtimes(A,B) [m,namb] = size(A); n = size(B,2); C = zeros(m,n); for ii = 1:m ...

15 years ago | 3

Answered
How to overwrite part of a matrix by a function of the row number.
without loop for r = 1:5; M(r,:) = r.'.^2*ones(1,size(M,2))

15 years ago | 1

Answered
How to simplify polynomial expansion?
factor(v) ans = (1050073985609136376117577180218721828864*z^3 - 1065633110957905273283671547044295504128*z^2 - 100560503...

15 years ago | 1

Answered
Program to find the median of the matrix (need to use for loop)
variant % size(Min) = [m1 n1], size(Msection) = [m2 n2] mn1 = size(Min)+2; Min1 = zeros(mn1); Min1(2:end-1,2:end-1) = M...

15 years ago | 0

Answered
Help me generating this series of number.
without loop for reshape(cumprod([1 2 5;10*ones(9,3)])',[],1); with loop for P = zeros(30,1); for ii = 1:20 if re...

15 years ago | 0

| accepted

Load more