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

oltre 9 anni fa | 0

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

oltre 9 anni fa | 0

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

oltre 9 anni fa | 0

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

oltre 9 anni fa | 1

| accettato

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

oltre 9 anni fa | 0

| accettato

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

oltre 9 anni fa | 2

| accettato

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

oltre 9 anni fa | 2

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

oltre 9 anni fa | 0

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

oltre 9 anni fa | 0

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

oltre 9 anni fa | 0

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

oltre 9 anni fa | 1

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

oltre 9 anni fa | 0

Risposto
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(:).’;

oltre 9 anni fa | 0

| accettato

Risposto
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);

oltre 9 anni fa | 2

| accettato

Risposto
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);

oltre 9 anni fa | 0

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

oltre 9 anni fa | 0

| accettato

Risposto
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);

oltre 9 anni fa | 1

| accettato

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

oltre 9 anni fa | 0

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

oltre 9 anni fa | 0

| accettato

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

oltre 9 anni fa | 1

Risposto
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);...

oltre 9 anni fa | 2

| accettato

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

oltre 9 anni fa | 0

| accettato

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

oltre 9 anni fa | 1

| accettato

Risposto
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; %...

oltre 9 anni fa | 10

| accettato

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

oltre 9 anni fa | 2

| accettato

Risposto
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);...

oltre 9 anni fa | 0

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

oltre 9 anni fa | 0

| accettato

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

oltre 9 anni fa | 1

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

oltre 9 anni fa | 0

Carica altro