Community Profile # David Hill

Last seen: Today Active since 2017

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

Working as Undergraduate Research Assistant in the field of Computational Photonics

#### Statistics

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

View by

Random number selection from matrix column and from decimal number
[A(randi(3,1,4)+[0 3 6 9]),rand(1,2)];

7 days ago | 0

How to store array?
x=0:.1:3; for k=1:length(x) A=[5*x(k),0;2*x(k)^2,1] B=[0;2.55] Y(:,k)=A\B; end

7 days ago | 1

How to fill a matrix with formula
y=reshape(y,5,[])';

8 days ago | 1

| accepted

Create table of means from multiple tables
temp=T1.Properties.VariableNames; T=array2table((T1{:,:}+T2{:,:}+T3{:,:})/3); T.Properties.VariableNames=temp;

10 days ago | 0

Printing out zeros as empty character for a tex file
s=sprintf([num2str(i) ' & ' num2str(myData(i,1), format)... ' & ' num2str(myData(i,2), format) ... ' & ' nu...

1 month ago | 0

| accepted

Change error bar colour and data point colour in a loop
errorbar(x(i),y(i),err(i),'o', 'LineWidth', 2, 'MarkerFaceColor','g','Color','g');

1 month ago | 1

| accepted

How do I randomly extract 20 segments of data from a signal?
You could just keep matrix form with a 3rd dimension for k=1:20 newMatrix(:,:,k)=yourMatrix(randperm(60001,1000),:); end

1 month ago | 0

Plotting the function of single variable
n0 = 400; r0 = 1/n0; gamma = 1.26; p=20;%assumed s=.7;%assumed P=1:(p+1); r=r0*gamma.^(0:p); N=@(t)r0*n0*(2*s/(2*s-1))^(p...

1 month ago | 0

how to plot cell array continuously as line
y = cell2mat(A(1:20)); plot(1:numel(y),y);

1 month ago | 0

selecting 2 bits from given input bit stream alternatively
A=reshape(a,2,[])'; b=A(1:2:end,:); c=A(2:2:end,:);%matrix form %you could also convert to binary A=sum(A.*[2 1],2); b=dec2...

1 month ago | 0

| accepted

how to solve equation
y=zeros(size(x)); y(x==1)=3; y(x~=1)=x(x~=1).^3+55;

1 month ago | 0

How can I properly format small numbers using num2str?
soly=num2str(y,'%.3E') solx=num2str(x,'%.3E')

1 month ago | 0

| accepted

how to sum array
B'+A;

1 month ago | 0

Insert column of strings into numerical matrix
Cannot put date strings into a matrix of numbers. Convert date strings to numbers (datenum) and insert. If you want the date str...

1 month ago | 0

how do i write this in matlab?
syms x i=0:.1:1; for k=0:10 for j=1:11 K(j,k+1)=int(euler(k,x),x,[0,i(j)]); end end K=double(K);

2 months ago | 0

| accepted

How to reverse a Ax=b system of equation to find an A value from a x and b value
R1=4000; R2=8000; syms R3; R4=2000; R5=5000; v=125; A=[0 R2 0 R4 0 0 -R1 R2 -R3 0 0 0 0 0 R3 R4 -R5 0 1 1...

2 months ago | 0

| accepted

How to calculate coefficient of variation for every element in Matrix?
cv=std(datan,0,'all')/mean(datan,'all');

2 months ago | 1

Save vales in Harry in a for loop
No loop needed. Ri_A=numbA_IntStat./(E_i.*cos(numbGrad).*ds);%assuming all the same sized variables

2 months ago | 2

how can i integrate a function which has three variables but has to integrate it with respect to only one variable
For example: syms a b d e t; f=d^2*cos(e)/exp(t); I=int(f,e,a,b);

2 months ago | 0

Surface plot from excel data
a=readmatrix('test1.xlsx'); x=a(1,2:end); y=a(2:end,1); z=a(2:end,2:end); [X,Y]=meshgrid(x,y); surf(X,Y,z)

2 months ago | 1

| accepted

I'm new in matlab and I'm having trouble with the coding
x=(2*s*(4*s^2+19*s+20))/(20*s^4+66*s^3+73*s^2+57*s+30);%s is scalar x=(2*s.*(4*s.^2+19*s+20))./(20*s.^4+66*s.^3+73*s.^2+57*s+30...

2 months ago | 0

Multiply each element of a matrix by different element from another matrix
massg=10^-5:10; %mass [g] mass=massg/1000; %mass [kg] Ra_leo=2000; Ra_geo=35786; % altitude[km] R=6378; %Radius of Earth [km]...

2 months ago | 0

Improving the speed of a double for loop through vectorization or changing summation indices
What is rep doing? Seems to just be multiplying. for rep = 1:10000 for p=0:N_M_min for q=0:p coeff(p+1) = coeff(...

2 months ago | 0

A simple rout algorithm in finding the way from point (0,0) to a random point (x1,y1) in a block
I would use a graph. M=zeros(100);%adjacency matrix start r=randperm(100,11);%ten random nodes with last node the end point e...

2 months ago | 1

| accepted

How to use multiple break statments
for i = 1:100 if ~(sln2.Error<=1) Ext.W22=beta*Ext.W22; Ext.W22List(i) = Ext.W22; end sln3.Erro...

2 months ago | 0

| accepted

Find minimum and maximum from same matrix
m=yourMatrix; m(m<=0)=inf; Min=min(m,[],'all'); m=yourMatrix; m(m>=0)=0; Max=-max(abs(m),[],'all');

2 months ago | 0

Find Consecutive numbers and print value in next collumn
Simple loop works c=0; f(:,6)=0; for k=1:size(f,1) if f(k,5)==1 c=c+1; f(k,6)=c; else c=0; end end

2 months ago | 1

Check every element of an array with if statement
z = [0.2+(-500:.05:500)*1i]; R = (z-1)./(z+1); x = abs(R); idx=x<=1; plot(real(R(idx)),imag(R(idx)),'b'); title('R Pla...

2 months ago | 0

| accepted

Producing all combinations of a vector with replacement
[x,y]=meshgrid(1:4); z=unique(sort([x(:),y(:)],2),'rows');

2 months ago | 1

| accepted