Community Profile

photo

David Hill


Last seen: Today
1,794 total contributions since 2017

Contact

David Hill's Badges

  • 12 Month Streak
  • Guiding Light
  • Knowledgeable Level 4
  • Indexing II Master
  • Sequences And Series III Master
  • Puzzler
  • 5-Star Galaxy Level 2
  • Personal Best Downloads Level 3
  • First Review
  • Scholar
  • First Submission
  • Revival Level 1
  • Creator
  • Leader
  • Computational Geometry II Master

View all

Contributions in
View by

Answered
How can I record value once condition is satisfied by searching a matrix?
newMatrix=yourMatrix(yourMatrix(:,2)<=tol,4:5);

2 days ago | 0

Solved


Evil Number
Check if a given natural number is evil or not. Read more at <https://oeis.org/A001969 OEIS>.

4 days ago

Solved


Armstrong Number
Determine whether the given input n-digit number is Armstrong Number or not. Return True if it is an Armstrong Number. An n-D...

4 days ago

Solved


Narcissistic number ?
Inspired by Problem 2056 created by Ted. In recreational number theory, a narcissistic number is a number that is the sum of ...

4 days ago

Solved


Parasitic numbers
Test whether the first input x is an n-parasitic number: <http://en.wikipedia.org/wiki/Parasitic_number>. ( _n_ is the second in...

5 days ago

Solved


Can the given sides form a triangle?
Can the three given sides form a triangle?

5 days ago

Solved


Brain Teaser Solver
Write an algorithm to solve this brain teaser: You have a square that is broken into four triangles, the area of three of tho...

5 days ago

Solved


Minimum possible M of the maximum side of a triangle of given area A.
Suppose a triangle has area A. Suppose it has three sides S1, S2, and S3. Suppose M = max([S1 S2 S3]). What is the minimum po...

5 days ago

Solved


matrix zigzag
Unfold a 2-D matrix to a 1-D array in zig-zag order, e.g., for matrix [ 1 2 3 ; 4 5 6 ; 7 8 9 ] the resulting 1-...

8 days ago

Answered
Convert a fixed width char array into a column vector
str2num(reshape(aa,8,[])');

9 days ago | 1

| accepted

Solved


Sub-sequence - 01
Find the length of the longest increasing subsequence in the given array. a=[2,4,2,1,3,5,6] longest increasing subsequen...

10 days ago

Solved


Construct the Seidel-Entringer-Arnold triangle
Several problems in Cody ask us to construct part or all of triangles in which entries follow a pattern. Cody Problems <https://...

10 days ago

Answered
Vectorization of For-If combination
Can't think of any better way to do your problem. Only 1 loop now. x=zeros(1000,1); for i=1:10 x(i:i:10*i)=1; x(2*i:2*i:20...

12 days ago | 0

| accepted

Answered
How can I measure time on MATLAB?
n=200; A=full(gallery('tridiag',n,1,2,1)); a=[3,6]; b=randn(n,1); for k=1:length(a) tic [L,U]=lu(A+a(k)*eye(n)); t(...

12 days ago | 0

Answered
How do I sum the points from all the innings of each game on each team?
readtable(); a=table2array();%look at this command opp=sum(a(:,1:9),2); us=sum(a(:,10:18),2); %create new table for printing...

12 days ago | 0

Answered
Finding the max of column 2 and column 3
A(:,4)=max(A(:,2:3),[],2);

12 days ago | 0

Solved


Pandigital Multiples of 11 (based on Project Euler 491)
A "Pandigital number of order X" is one that contains all of the numbers from 0 to X, but with no leading zeroes. If X>9, the cy...

13 days ago

Solved


Day counter function
Write a function called _day_counter_ that returns the number of Mondays that fell on the first day of the month in a given year...

15 days ago

Answered
Incorrect dimensions for matrix multiplication.
y=((x.^2).*exp(x-4)-x+1)./(2+cos(5*x));%you likely want element-wise operations .* and ./

16 days ago | 1

Answered
help me, why is it invalid use of operator?
Not sure if you have additional constraints, but if your functions are all polynomials, the polyint function works well. p=[-.0...

16 days ago | 0

Answered
I want to creat the loop of background substraction.
Place all images into a cell array. for m=2:length(image) k{m-1}=image{1}-image{m}; end

21 days ago | 0

| accepted

Answered
Replacing elements in matrix
a=[0 0 0 0 ; 1 2 1 2 ; 2 0 0 -1 ; -1 0 -1 -2 ; -2 -2 -2 0]; b=sum(a>0)-sum(a<0); for k=1:length(b) if b(k)<0 for...

21 days ago | 0

Answered
Finding minimums and maximums of repetitive numbers in a matrix
Might need to filter slightly to smooth data to obtain consistent results. redA=islocalmax(a)&a>.1; greenA=islocalmin(diff([a(...

21 days ago | 1

| accepted

Answered
Get the numbers of rows where values change
b=diff(a);%a being your matrix c=find(b(:,1)~=0|b(:,2)~=0);%c=3,5,7

21 days ago | 1

Answered
how to create a random integernumbers with conditions?
A=[4 3 3]; a=[]; for k=1:length(A) a=[a,repmat(k,1,A(k))]; end for k=1:5 a=a(randperm(length(a)));%you don't neces...

21 days ago | 0

Answered
create coordination matrix from zig zag path
x=0:9;%xend odd only y=[0;410;410;0]; A=[repelem(x',2),repmat(y,(x(end)+1)/2,1)];

23 days ago | 0

| accepted

Answered
How to represent a set of matrices into a single cell?
I would keep them all in a single matrix and then form matrix E (a*b X 4) where each row would hold the cell information of your...

24 days ago | 1

Answered
Calculating Harmonic Average in Matlab Function
What is ky? Why not just perform vectorized? No need to index into k. k can be any length vector and the below will calculate th...

24 days ago | 0

Answered
How to calculate the jumper's final distance on this problem?
function dist=BJump(v,theta,rho,s) x=0; g=9.81; c=.72; dt=.000001;%not sure how accurate you need y=v*s...

25 days ago | 0

| accepted

Load more