# David Hill

Electrical Engineering with minors in Computer Science, Mathematics, and Creative Writing.

Working as Undergraduate Research Assistant in the field of Computational Photonics

**Statistics**

RANK**45**

of 250,107

REPUTATION**3,484**

CONTRIBUTIONS

**0** Questions

**1,435** Answers

ANSWER ACCEPTANCE **
0.00%
**

VOTES RECEIVED**384**

RANK**3,016** of 17,375

REPUTATION**480**

AVERAGE RATING**4.80**

CONTRIBUTIONS**19** Files

DOWNLOADS **165**

ALL TIME DOWNLOADS**3532**

CONTRIBUTIONS**0 Posts**

CONTRIBUTIONS**0** Public Channels

AVERAGE RATING

CONTRIBUTIONS**0** Highlights

AVERAGE NO. OF LIKES

**Content Feed**

Difference Calculation between current value and a specified prior value

Not sure exactly what you are after, an example would be helpful. B=(x(1:10)-x(10:19))./x(10:19);

4 days ago | 0

Count the number of times a value repeats between certain rows in a matrix.

A=[2,5,15,65,102;2,65,1,105,55;65,104,15,19,5]; i=A(1,ismember(A(1,:),A(2,:)));

4 days ago | 0

why doesnt it work

function x = ss_dtmf(number,dt,nd,np) x=[]; for i=1:length(number) x = [x,ss_dtmf1(number(i),0:nd:dt),ss_dtmf1(12,0:np:dt...

5 days ago | 0

Split a vector into 2 oscillating vectors?

v1=zeros(1,500000); v2=zeros(1,500000); for k=1:100 v1((k-1)*5000+1:k*5000)=v((2*(k-1))*5000+1:(2*(k-1)+1)*5000); v2((k-...

5 days ago | 0

Number of rows based on frequency of one integer and position of another integer

r=unique(matrix(:,2)); r=r(end-4:end); n=nnz(matrix(:,1)==10&ismember(matrix(:,2),r));

6 days ago | 0

Index Out of Bound for 1x1 Array

Use readmatrix data1 = readmatrix('4665_10.85.txt');

13 days ago | 0

Merge selected column elements from two matrices into a new matrix

If the number of non-zeros is not constant in the combined cA,cB rows, then cT will need to be a cell array. for k=1:size(cA,1)...

20 days ago | 0

| accepted

ive tried doing it but i dont know why the plot is not right t=-2:0.1:2; if t<=-1 y=-5.*t-5; elseif t<0 y=t.^2+1; elseif t<1 y=pi.^t; elseif t>=1 y=pi+sin(pi

t=-2:.1:2; f=zeros(size(t)); f(t<=-1)=-5*(t(t<=-1))-5; f(t>-1&t<0)=t(t>-1&t<0).^2+1; f(t>=0&t<1)=pi.^(t(t>=0&t<1)); f(t>=1)...

24 days ago | 0

| accepted

If statement without loop

TR1_Ge70(TR1>TR1_Ge70(:,1))=0; for k=1:size(A,2) C(:,:,k)=A(:,k).*B; end

27 days ago | 0

sorting with respect to specific column

s=sortrows(yourMatrix,6);

28 days ago | 0

| accepted

Remove values from column that are close in value to each other

x=sort(x);%make sure x is sorted x(diff(x)<2)=[];

1 month ago | 1

Problem with sum of numbers in array; first i want just the first number, then 1st and 2nd; then 1st, 2nd and 3rd all the way to the last.

cumsum(x)

1 month ago | 0

| accepted

How to change Matlab display format for numbers

Look at the options under format help format format bank

1 month ago | 0

| accepted

Creating plot with double x axis

Why not just use subplot? subplot(2,1,1) plot(u1,y) subplot(2,1,2) plot(u2,y)

1 month ago | 1

| accepted

arrangment matrix in special way

Z=zeros(4); d=[A;B;Z;Z;C]; D=d; for k=2:5 d=circshift(d,4,1); D=[D,d]; end

1 month ago | 0

| accepted

Attempting to plot a function with a for loop, but nothing is working.

kilotons=input('kilotons of blast'); i=1:2:50; con = (kilotons * (1.2*10^8))./(pi*i.^2); plot(i,con); ylabel('Concentration'...

2 months ago | 2

Passing a vector (array) into a differentiated function

syms x; f = x^2 -1; Df1 = diff((f)); Df2 = diff((Df1)); y = (0:0.05:1); F= double(subs(f,x,y)); DF1= double(subs(Df1,x,y))...

2 months ago | 1

| accepted

How to store multiple variables on Matlab?

If every line is related and numbers of the same kind (floating point), then storing in a matrix can be more efficient (use inde...

2 months ago | 1

Circe center coordinates and radius from coordinades ( A, B, C )

syms h k r x1 x2 x3 y1 y2 y3 eqn1=(x1-h)^2+(y1-k)^2==r^2; eqn2=(x2-h)^2+(y2-k)^2==r^2; eqn3=(x3-h)^2+(y3-k)^2==r^2; [H,K,R]=...

2 months ago | 0

| accepted

How can I make the program count the number of decimals of an inputted amount

if you don't care about zeros entered. x=46.4500000;%if this would be valid if ~isequal(floor(x*100),x*100) 'invalid' end...

2 months ago | 0

I want to get the mean of cells in column 4 based on the column 1 value.

m=floor(yourMatrix(:,1)); M=259:374; for k=1:length(M) n(k)=mean(yourMatrix(m==M(k),4)); end

2 months ago | 0

| accepted

Reading certain columns of data bigger than a number into one array smaller into another

for i = 1:length(namelist) filename = namelist{i}; data = readmatrix(filename);%try readmatrix High = [High;data(...

2 months ago | 0

making a exponential from a for loop

k=6*10.^(1:10); Cd=1.5*10.^(1:8);

2 months ago | 0

| accepted

Need help calling a function

Not exactly sure what you are asking. Do you want to call the last function in your main function? I simple way to look at the o...

2 months ago | 0

Find all possible combinations of string array

You could get all possible combinations and then index into your struct. [idxa,idxb,idxc]=ndgrid(1:5,1:3,1:7);

2 months ago | 0

Creating a column vector form data in table to meet specific requirements.

risk=ones(size(age)); risk(age>75|BMI>50)=3; risk(age>50&age<=75&BMI>40&BMI<=50)=2;

2 months ago | 0

| accepted

what changes can be made in the code?

function out = mycumsum (m) out = m(1); for i = 2:length(m) out(i)=out(i-1)+m(i); end

2 months ago | 0

how can do get this

You could simply look at the difference a=[5 9.8 15 6 10 9.5 9.7 9.8 9.8 9.8 9.8]; idx=find(diff(a)==0,1);

2 months ago | 0

| accepted

RS-232 Serial Communication (Mark-10)

Look at your manual for your instrument to set up the parameters s = serialport('COM1',115200);%create object s.DataBits=8; s...

2 months ago | 0

| accepted

What does this line really do?

Look at what this does. a=randi(2,1,20)-1 a(a==1)=-1%same as a(1,a==1)=-1 a(a==0)=1%same as a(1,a==0)=1;

2 months ago | 0

| accepted