Community Profile # David Hill

Last seen: Today Active since 2017

Electrical Engineering with minors in Computer Science and Mathematics. Working as an Undergraduate Research Assistant in the field of Robotics.

Programming Languages:
Python, C++, C, Java, MATLAB, HTML, Arduino
Spoken Languages:
English, Spanish
Professional Interests:

#### Statistics

All
• • • • • • • • • • • • #### Content Feed

View by

Why is my loop not running? (Error using / Matrix dimensions must agree)
Cannot multiply by the entire array (cp). %heat transfer % A(i) = -((L*D*(cp(i) - cinf)) + (kair*(Tp(i) - Tb))); B(i)...

7 hours ago | 0

how to compute random??
Run a simulation many times below. tol=.01; for k=1:1000 %I ran the simulation 1000 times n=rand(1,10000); An=cumsum(n)...

7 hours ago | 0

moving averag : Out of memory. The likely cause is an infinite recursion within the program.
m=readmatrix('TX.txt'); x=movavgFilt(m(:,2)',5,'Center');%data needs to be row vector

15 hours ago | 0

Create a unit vector from two locations?
MTH2 = [0.472 1.364 0.06]; CoM = [0.471 1.147 0.903]; UnitVector = (CoM - MTH2) / norm(CoM - MTH2)

15 hours ago | 0

Replacing value by the mean of the two nearest neighbors
B = [20; 18; NaN; 25; 100; 15; -50; 23; NaN; 15; -15; 30]; idx=find(isnan(B)); B(idx)=mean([B(idx-1),B(idx+1)],2); idx=find(B...

18 hours ago | 0

How to permute elements of jth column of a matrix iteratively
A=[1,2,3 ; 7,8,9 ; 13,14,15]; perms_of_(A,2) function A_perms = perms_of_(A,j) p=perms(A(:,j)); for i = 1:length(p) A_p...

2 days ago | 0

| accepted

How To change Diagonal Elements with a string in matrix using FOR loop or other preferred method?
a='ALEX'; b=diag(double(a)); b(b==0)=48; string(char(b)) char(b)

2 days ago | 0

Unier matrices de diferentes tiempos e interpolarlarlas
newMatrix=[A;B;C];%where A,B,and C are your current matrices.

9 days ago | 0

How to calculate rate constant if population vs time table data is given?
N=[1 2 3 4.5 7 10 16 29 56 104]; fit((1:length(N))',N','exp1')

14 days ago | 0

How to generate a specific number of values within a range ?
a=sort(rand(10,2),2); A=[]; for k=1:size(a,1) A=[A;linspace(a(k,1),a(k,2),60)]; end

14 days ago | 0

Better work through indecies in a for loop
Just use continue. for n = 1:length(start0) if start0(n)-240 < 360 % If the filter time is not big enough then move ...

14 days ago | 0

| accepted

Different answers when I do the same integration
They are not the same expressions. syms x int((1+cos(x))^2,0,pi) int(1+2*cos(x)+cos(x)^2,0,pi) int(1+cos(x)^2-2*(1-cos(x)),0...

14 days ago | 0

How to read x and y values from a text file?
Should attach file for us to test. m=readmatrix('points.txt'); x=m(:,1)';y=m(:,2)';

14 days ago | 0

| accepted

Find rows based on set of values/codes
for i = 1:size(data,2) if all(ismember(data(i,:),[0 1 13 31 42 53]))%include 0

14 days ago | 0

For loop error, not getting desired output
x = [1 2 3 5; 4 3 1 3; 1 3 3 4]; y = [1 2 3 5; 4 3 1 3; 1 3 3 4]; columns = 3; for i = 1:columns correct = 0; for j...

15 days ago | 0

Ho to subtract row from a row in a matrix?
P= [1 4.6 -7.6 2.2 1.4 6.8 18.2 12; 1 5.6 7.4 2.8 11.4 4.8 28.2 -13; 8 9.5 11.7 13.8 12.6 4.7 -8.8 -23]; p=P(2,:)-P(1,:)

17 days ago | 0

grabbing specific rows from matrix
idx=ismember(xy_index(:,3),index); extracted_xy_index=xy_index(idx,:);

18 days ago | 0

For Loop "Array indices must be positive integers or logical values"
matlab starts indexing at 1, you cannot index into an array at 0 for k = 2:nmr if a(k) < a(k-1) & a(k-1) < a(k-2) & b(k) >...

18 days ago | 0

| accepted

How do you integrate a very long equation on MATLAB?
Numerical integration. p=@(x)(7.593*x.^6 - 231*x.^5 + 2316.1*x.^4 - 10644*x.^3 + 21966*x.^2 - 16304*x + 1000000).*... sqrt...

18 days ago | 0

can you help me fix this moving average filter it keeps giving me errors, I suppose to design a moving average filter from the filter equation bellow
Did you look at movmean r=randi(100,1,100); M=6; m=movmean(r,M,'Endpoints','discard')

18 days ago | 0

finding a number between 2 numbers
m=[88 65 98 34 100]; m(m>=95&m<=100)

18 days ago | 0

| accepted

Angle between two planes given xyz coordinate data from each plane
P1 = [1,-1,3]; P2 = [2,3,4]; P3 = [-5,6,7]; normal = cross(P1-P2, P1-P3); P4 = [4,-2,4]; P5 = [1,7,5]; P6 = [-3,5,9]; nor...

18 days ago | 0

| accepted

What is the easiest way to calculate the triple definite integral of a symbolic vector over arbitrary domain without using for loop?
syms x y z V=[x,y,z]; I=int(int(int(V,x),y),z);%recognize the definite integrals do not exist for many integrals (this works b...

18 days ago | 0

| accepted

How to check multiple values in an equation in MATLAB?
L=1390./(6:6:1390); Lmin=L(find(L>5,1,'last'))

18 days ago | 0

Problem with exp() function
Make sure your clear your workspace and do not have any function names 'exp' clear format long exp(1) exp(6)

18 days ago | 1

finding the closest value
data3=data1; S=sort(data2); idx= find(~ismember(data1,data2)); for k=idx f=find(S>data1(k),1); data3(k)=S(f); end

18 days ago | 0

How do I compare two shuffled vectors, and get the indexes of one as it appears in the other?
b=["cond4","cond2","cond1","cond3"];%needs to be string array [~,idx]=sort(b)

18 days ago | 1

Combination of two values in a list to get the value of an input value
list = [ 200 300 500 800 1200]; num = 1850; d=50;%small difference A=[]; for k=1:length(list) n=nchoosek(list,k); ...

18 days ago | 0

| accepted