Answered

How to find the closest value between a matrix and a vector and print out its index?

You mean something like this? I=[]; for k=1:length(v) [~,idx]=min(abs(m-v(k)),[],'all','linear'); I=[I,idx]; end

How to find the closest value between a matrix and a vector and print out its index?

You mean something like this? I=[]; for k=1:length(v) [~,idx]=min(abs(m-v(k)),[],'all','linear'); I=[I,idx]; end

1 day ago | 0

| accepted

Answered

creating a specific markov probability matrix

If you use linear indexing (iaw Matlab), then the bottom left vertix of your graph is 8 and the top right vertix is 57. Then the...

creating a specific markov probability matrix

If you use linear indexing (iaw Matlab), then the bottom left vertix of your graph is 8 and the top right vertix is 57. Then the...

1 day ago | 0

| accepted

Answered

Undefined function 'mtimes' for input arguments of type 'function_handle'.

c = [.01; 1]; x = 0:10:100; tbolt1 = [0.165,1.85,2.87,3.78,4.65,5.5,6.32,7.14,7.96,8.79,9.69]; t0 = tbolt1(1); te = tbolt1(...

Undefined function 'mtimes' for input arguments of type 'function_handle'.

c = [.01; 1]; x = 0:10:100; tbolt1 = [0.165,1.85,2.87,3.78,4.65,5.5,6.32,7.14,7.96,8.79,9.69]; t0 = tbolt1(1); te = tbolt1(...

1 day ago | 1

Answered

For loop not showing plot?

I answered your previous question also. This is the same answer. No loop is needed. Your override error on each loop to a single...

For loop not showing plot?

I answered your previous question also. This is the same answer. No loop is needed. Your override error on each loop to a single...

1 day ago | 0

Solved

Justify the character string in center with proportional fonts

how to justify a string of character into center with proportional fonts? Example: x='justify string ' output is ' justif...

2 days ago

Solved

Solve The Equation

The coefficients of a system of equations are given in two vectors, x1 and x2. Write a function to solve the equation and return...

2 days ago

Solved

Find The Difference

Vector x is given.calculate the difference between the biggest and the smallest number that we can create from elements of x. f...

2 days ago

Solved

Add 3 (x<=100) Or Subtract 100 and add 3(100<x)

Add 3 to every element. However, if the value is greater than 100, subtract 100 and add 3. eg. input x = [45 106; 67 1...

2 days ago

Solved

A kind of decryption

Please convert the vector to letters by referring to the examples below. (eg.1) input vec=[34 1 59] >>> output s='A Z' (eg...

2 days ago

Solved

Sort complex numbers into complex conjugate pairs

Sort complex numbers into complex conjugate pairs. Example: Input x = [3-6i -1-4i -1+4i 3+6i] Sorted output = [-1 - ...

2 days ago

Solved

Construct a string from letters and counts

Given two input arrays like this: [5,3,1] ['a','b','c'] Output a string that contains each letter the specified num...

2 days ago

Solved

Snakes on a plane

Given the dimensions of a 2-d plane, create a matrix where a "snake" of ones occupies the plane from top left to bottom right. ...

2 days ago

Solved

Four digit number ABCD reversal

write a MATLAB function to find the four-digit number ABCD when multiplied by 4 returns DCBA. The function takes an input x=4.

2 days ago

Solved

How many apple

You have x apples I take from you y apples now how many apples you have ?

2 days ago

Solved

Convert base 10 to base x (2-16)

Convert input number(s) (double) in base 10 to base x (2 through 16). Output should be a cell of character arrays. Compute outpu...

2 days ago

Answered

Need help in creating a script without using for loops.

N=length(x); Xk=sum(x.*exp((-1i*2*pi/N*(0:N-1)).*(0:N-1)'),2);

Need help in creating a script without using for loops.

N=length(x); Xk=sum(x.*exp((-1i*2*pi/N*(0:N-1)).*(0:N-1)'),2);

3 days ago | 0

Answered

If for example, I have the letter 'a' in table punnettSquare(2,1) and I want to add a letter 'b' to that same cell so that the element of the cell would be 'ab'. What function should I use?

punnettSquare{2}{1}='ab';

If for example, I have the letter 'a' in table punnettSquare(2,1) and I want to add a letter 'b' to that same cell so that the element of the cell would be 'ab'. What function should I use?

punnettSquare{2}{1}='ab';

3 days ago | 0

Answered

No values in plot?

Not sure what you were doing, but each loop iteration you were overriding your data. No loop needed. My_numb_1=1:50; My_numb_2...

No values in plot?

Not sure what you were doing, but each loop iteration you were overriding your data. No loop needed. My_numb_1=1:50; My_numb_2...

3 days ago | 0

Answered

Detect consecutive positive numbers in an array

A(A<0)=0;%if negative numbers possible A(A>9)=9;%if >single digit possible a=num2str(A); a=a(a~=' '); B=[regexp(a,'[1-9]*')'...

Detect consecutive positive numbers in an array

A(A<0)=0;%if negative numbers possible A(A>9)=9;%if >single digit possible a=num2str(A); a=a(a~=' '); B=[regexp(a,'[1-9]*')'...

3 days ago | 1

| accepted

Solved

Finding fourier transform of a given vector

Find the fourier transform of a given input vector for ex a=[1 2 3 4] then y=[ 10.0000 + 0.0000i -2.0000 +...

3 days ago

Solved

replace empty matrices with '[]'

for example a=1;a(:,1)=[]; returns a = Empty matrix: 1-by-0 use this as the input,and the output should be '[]...

3 days ago

Solved

Min by mean

Substitute the minimum value in each row of a matrix A by the mean of that row (it should also work if the input is a vector)

3 days ago

Solved

Accessing value of variable whose name is stored in another variable as string.

Accessing value of variable whose name is stored in another variable as string. for example: var1=n; var2='var1'; %Assigning...

3 days ago

Solved

given number is power of n or not?

Check weather The input is power of n or not? for example x=8,n=2 --> true x=6,n=2 --> false

3 days ago

Answered

For Loop Using the Previous Calculated Term for Each Iteration

t=0:60:900 rate_NaCl(1)=r_NaCl; for k=2:length(t)-1 rate_NaCl(k)=sqrt(rate_NaCl(k-1)^2 + 2*rdrdt_NaCl*t(k)); end plot(t...

For Loop Using the Previous Calculated Term for Each Iteration

t=0:60:900 rate_NaCl(1)=r_NaCl; for k=2:length(t)-1 rate_NaCl(k)=sqrt(rate_NaCl(k-1)^2 + 2*rdrdt_NaCl*t(k)); end plot(t...

3 days ago | 1

| accepted

Answered

Adding to an array within a For loop?

No loop needed. gpa4=nnz(data(:,3) == 4); class_honors=nnz(data(:,2) == 2015 & data(:,3) >= 3.5); class_psych=nnz(data(:,2) =...

Adding to an array within a For loop?

No loop needed. gpa4=nnz(data(:,3) == 4); class_honors=nnz(data(:,2) == 2015 & data(:,3) >= 3.5); class_psych=nnz(data(:,2) =...

3 days ago | 0

Answered

How to plot the values found in a for loop?

Are X, Ex, Ey, Gamxy constants not listed? Recommned executing without loop; otherwise you need to index Ebca/Ebcb/Ebcc. Current...

How to plot the values found in a for loop?

Are X, Ex, Ey, Gamxy constants not listed? Recommned executing without loop; otherwise you need to index Ebca/Ebcb/Ebcc. Current...

3 days ago | 0