Respondida
How to reshape and repeat at the same time.
newdata = reshape(repmat(reshape(data,2,[]),2,1),2,[]);

alrededor de 9 años hace | 0

Respondida
How to find the intersection of two curves
You can use a modified version of the Newton-Raphson method for finding the intersection of two parameterized curves, provided t...

alrededor de 9 años hace | 0

Respondida
How to find the intersection of two curves
You can convert this into the equations of two slanted ellipses. The first ellipse is: (x-y)^2+(2*x+y)^2 = 5*x^2+2*x*y+2*y...

alrededor de 9 años hace | 0

Respondida
hi my matrix=12x5, i need to subtract all these and finally get 12x1 i.e 12x1-12x2, result of (12x1-12x2)-12x3,then result of ((12x1-12x2)-12x3)-12x4..................so on
Let M be your 12 by 5 matrix and V your result. V = M(:,1)-sum(M(:,2:end),2);

alrededor de 9 años hace | 0

Respondida
Trying to Find the solution of trigonometric equation
Rather than using ‘solve’, you should try ‘fzero’ with various different estimated values for y obtained from doing a plot. Thi...

alrededor de 9 años hace | 1

| aceptada

Respondida
Attempted to access E(3,1); index must be a positive integer or logical. But the index is (3,1) those numbers are both positive. What is going on?
E(t*5,i) has indices that are not always precisely positive integers, because t cannot be precisely equal to all multiples of 0....

alrededor de 9 años hace | 0

| aceptada

Respondida
Can anyone help me in optimizing (maximizing) the function of two variables?
You don’t need matlab to find the maximum value of this function. The subtraction by 398 does not affect maximization, nor does...

alrededor de 9 años hace | 2

| aceptada

Respondida
How to find time of flight
It is possibly easier to think of this problem as having the air stand still and both the transmitter and the receiver moving in...

alrededor de 9 años hace | 2

Respondida
i have a problem ,
If the derivatives of f with respect to x, to y, and to z are always zero, that means f must be a constant. Whatever the initia...

alrededor de 9 años hace | 0

Respondida
Modify array zeros detect
You could also use the following method. A is a row vector with 1’s and 0’s, and m is the least number of successive 0’s before...

alrededor de 9 años hace | 0

Respondida
Why does this plot not work? Thank's for every help!
It would be better to first solve the equation for y symbolically and then produce a vector of y values: x = linspace(0.5,8...

alrededor de 9 años hace | 0

Respondida
Getting decrease in a sine wave as a function of time
The data you show should probably be fitted with something like: a*exp(-b*time)*sin(c*time+d) with the four parameters, ...

alrededor de 9 años hace | 1

Respondida
Distances along a plotted line?
The approximate arclength along your curve from (x(i1),y(i1)) to (x(i2),y(i2)) can be computed as the sum of the line segment le...

alrededor de 9 años hace | 0

Respondida
How can I choose specific rows in a matrix? (from 1 to 6 than skip 7 to 16 and start taking again from 17th to 22nd)
X = 1:43008; Y = reshape(X,16,[]); Z = Y; Y = Y(1:6,:); Y = Y(:).’; Z = Z(7:16,:); Z = Z(:).’;

alrededor de 9 años hace | 0

| aceptada

Respondida
Dividing every element in a row from a 2x2 matrix by an element from same row from a 2x1 matrix
C = bsxfun(@rdivide,A,B);

alrededor de 9 años hace | 2

| aceptada

Respondida
How can I make these separate for loops into a nested for loop together?
You don’t need for-loops at all. k = zeros(size(A)); k(1:5,6:11) = A(3:7,1:6);

alrededor de 9 años hace | 0

Respondida
I want a matrix to be represented in the form of an array
Here are the “Pixel Scan” and “Rearrange” operations: % Let M be the m by n image matrix % Pixel Scan: M = M.'; M(...

alrededor de 9 años hace | 0

| aceptada

Respondida
Split a vector into two vectors randomly
Why not do this: t = original_vec(randperm(Total_Samples)); First_vec = t(1:25); Second_vec = t(26:36);

alrededor de 9 años hace | 1

| aceptada

Respondida
How to plot a piecewise function?
If you only want to plot the function, do this: x1 = linspace(-5,0,50); y1 = 10*ones(1,50); x2 = linspace(0,9,90); y2 =...

alrededor de 9 años hace | 0

Respondida
How I can use perms_reps(vec,reps) function with big vectors
For your particular problem, try this: C = nchoosek(1:45,5); n = size(C,1); M = zeros(n,45); % If you get this far...

alrededor de 9 años hace | 0

| aceptada

Respondida
Finding real roots of a cubic equation
This is an equation that can be manipulated so that d is one of the roots of a ninth degree polynomial equation of which only on...

alrededor de 9 años hace | 1

Respondida
Array that contains a geometric series
A general form for a geometric series is: [a,a*r,a*r^2,a*r^3,...] You can generate n of these by: s = a*r.^(0:n-1);...

alrededor de 9 años hace | 2

| aceptada

Respondida
Using conditional IF statement
if all(sum(B,2)==1)

alrededor de 9 años hace | 0

| aceptada

Respondida
i need to reshape rows that are in complicated manner!
The number of rows in A must be even. n = size(A,2); B = reshape(A.’,2*n,[]); B = B(ceil((1:2*n)/2)+n*mod(0:2*n-1,2)...

alrededor de 9 años hace | 1

| aceptada

Respondida
Count number of consecutive 1's within a block
Let x be the given row vector. f = find(diff([0,x,0]==1)); p = f(1:2:end-1); % Start indices y = f(2:2:end)-p; %...

alrededor de 9 años hace | 10

| aceptada

Respondida
Non-Sorted nx1 unique values
Let x be the given n by 1 vector. [y,p] = sort(x); d = diff(y)~=0; b = [d;true] & [true;d]; b(p) = b; Then b wi...

alrededor de 9 años hace | 2

| aceptada

Respondida
i want vector which is long size and each time size change but pattren is same in putting value
Let your resulting matrix, M, have m rows and n columns. b = mod(0:n-1,2)==0; M = repmat((1:n).*b+(-1:n-2).*(~b),m,1);...

alrededor de 9 años hace | 0

Respondida
How to avoid using 'For loops' while I need to do some operations on the columns of a matrix?
I assume that mu is 1 by d, Sigma is d by d, w is 1 by d, and y is k by 1 where d is the number of elements in the multivariate ...

alrededor de 9 años hace | 0

| aceptada

Respondida
How can I have a warning issued when matlab "rounds" a large number to Inf?
Matlab overflows to infinity (or minus infinity) whenever the result of an operation would round an answer beyond the largest nu...

alrededor de 9 años hace | 1

Respondida
lognrnd Function does not work properly at high variance
If you look at the probability density function that corresponds to your particular mu and sigma combination, you will see that ...

alrededor de 9 años hace | 0

Cargar más