Question

find intersection between matrix and vector

I have a matrix and a vector: M = 1.0e+010 * 0.1499 0.2998 0.4497 0.0996 0.2495 0.3501 0.2002 0.0503...

10 years ago | 2 answers | 0

Question

vector confusion

I have a vector A whose values are indices for vector P. Say A = 2 occurs 10 times. If I do: P(A) = P(A) + 1 P(2) = ...

10 years ago | 1 answer | 0

Question

How do I plot lines with different line widths?

Hi, I want to do: plot(x1,y1,x2,y2,'LineWidth',8) but the linewidth propery ends up applying to both lines. Do I have...

10 years ago | 5 answers | 3

Question

vectorize this operation - help

Hi guys, I am trying to vectorize the following operations. k = [1 10:10:90]; p = 10:10:100 Note k and p are mad...

10 years ago | 1 answer | 0

Question

Return equal values between sets.

I have two vectors a and b of different lengths that contain integers. How can I return those values that belong in both a and ...

10 years ago | 1 answer | 0

Answered

find values between constants in vector

ah. I think I got it: find(freq_n <= freq_in+10*delta_f & freq_n >= freq_in-10*delta_f) I was initially using && and tha...

find values between constants in vector

ah. I think I got it: find(freq_n <= freq_in+10*delta_f & freq_n >= freq_in-10*delta_f) I was initially using && and tha...

10 years ago | 0

Question

find values between constants in vector

I have a vector freq_n where I want to find the indices corresponding to values between a and b. freq_in-10*delta_f <= freq_n...

10 years ago | 3 answers | 0

Question

round-off issue?

I can't figure out why the floor wont come to 1752? >> 3.501/40*20*10^3+1.5 ans = 1.75200000000...

10 years ago | 1 answer | 0

Question

trailing 01s and 9s

Hi guys, I'm having rounding issues in my answers: freq_in = 1.499; h = 0:1:H-1; f_harm = (h+1)*freq_in f_harm ...

10 years ago | 2 answers | 0

Answered

matrix and vector indices out of range

Thinking about it, I could probably do: ind_plus_wi(ind_plus_wi < 1) = K/2+2 and X(ind_plus_wi) = v(i_M); X = X...

matrix and vector indices out of range

Thinking about it, I could probably do: ind_plus_wi(ind_plus_wi < 1) = K/2+2 and X(ind_plus_wi) = v(i_M); X = X...

10 years ago | 0

| accepted

Question

matrix and vector indices out of range

Hi guys, I have the following code: K = 20*10^3; X = zeros(1,K/2+1); w = 10 wi = repmat(1:w,length(i),1); ...

10 years ago | 2 answers | 0

Question

create vector of repeating elements (sort of)

How can I easily create a vector such that: w = 3 n = 8 v = (1 w times) (2 w times) (3 w times) ... (n w time...

10 years ago | 5 answers | 0

Question

Create matrix by adding elements of two vectors?

Hi guys, I have two vectors: h = 0 8 16 24 32 g = 0 1 2 3 4 5 ...

10 years ago | 2 answers | 0

Question

Test every element in matrix

I have an M x N matrix, where I want to test whether each element is greater than some constant a, and if it is, perform some ar...

10 years ago | 1 answer | 0

Question

Matrix with alternating signs in each row vector

Hi Guys, Is there a way to improve on this code that I wrote to optimize it? M = zeros(M,N); % create an MxN matrix M(1,:...

10 years ago | 4 answers | 0