Community Profile

# David Hill

##### Last seen: Today
1,185 total contributions since 2017

View all

Contributions in
View by

Solved

Make one vector from two others
You are given two vectors of equal length. Your task is to create a MATLAB script that will repeat all of the values in the fir...

10 hours ago

How can I mutiply every elements in a matrix by another given kernel matrix and then superpose them accodingly?
I think this would work as long as you specify that the square matrix is odd sized. C=conv2(A,B); a=size(A,1); C=C((a+1)/2:en...

12 hours ago | 0

How to remove the apostrophe's from a cell
Try this: A=str2double(string(A));

13 hours ago | 1

| accepted

help clarifying why code isn't working
fprintf('%15.4f %15.4f %15.4f %15.4f\n',M(1,:),M(2,:),M(3,:),M(4,:));

1 day ago | 0

| accepted

converting a vector to matrix
Not sure if this is what you are after, but it could be a starting point. Not sure what you mean by ruler lines above and below....

1 day ago | 0

| accepted

undefined function inside two if statements
Do not know what you want when you say if RoundedBoverT == 2 ... if nnz(RoundedBoverT == 2)%do you mean any element of matrix =...

1 day ago | 0

Search the given index of a column and then replace the entire column with a single value.
Not sure if this is what you want. [~,col]=ind2sub(size(Data),QI); Data(:,col)=repmat(Mid,1,length(col));

1 day ago | 0

Could anyone help to covert the equation into matlab code
Not sure what arrays p and g should be. B=sum(log(1+(p(2:n).*g(2:n))./(1+arrayfun(@(x)sum(x*g(3:n)),p(2:n))))/log(2));

1 day ago | 1

| accepted

Solved

What's the missing interior angle?
I'm talking about polygons... The sum of the interior angles of a triangle is 180 degrees. The sum of the interior angles of a...

1 day ago

How to compare pair of rows in a column and report it in hexadecimal format
Try this: x=reshape(mymatrix,2,[])'; y=num2str(x(:,1)>x(:,2))'; y=dec2hex(bin2dec(reshape(y(y~=' '),8,[])'))'; hexRep=y(:)';...

2 days ago | 1

| accepted

Solved

Find the maximum two numbers of every column of a matrix
Find the maximum two numbers of every column of a matrix. Example: If we input a matrix A = [ 1 2 4 6 0 3 ...

2 days ago

Plotting 3 graphs in the same figure
z=@(x)x.*sin(pi*(9*x+1)); x={-1:.2:1,-1:.1:1,-1:.01:1}; y=cellfun(@(k)z(k),x,'UniformOutput',false); plot(x{1},y{1},x{2},y{2}...

2 days ago | 0

reshape a char array
reshape(ex,[3,7])'; First number is row and second is column. Matrix is numbered down first.

2 days ago | 0

| accepted

logarithmic scale on MATLAB
semilogx();

2 days ago | 0

Solved

Do they touch?
The center and radius of two circles are given. Determine whether they touch.

2 days ago

How to insert a column in a cell array
Cell arrays can contain anything in there cells. Inserting a empty holder for a column vector: b={a{1:2},[],a{3:end}}

3 days ago | 1

| accepted

How can i plot this function in matlab
You could do something like this: p=1:2:100000; A=1; T=2; f=@(t)A/2 +2*A/pi*sum(sin(p*2*pi*t/T)./p); t=0:.1:2; for k=1:len...

3 days ago | 0

Splitting a matrix into 2 sub matrices based on row number
y=M([1 4 7 8 9 10],:); z=M([2 3 5 6],:);

3 days ago | 0

| accepted

Newton Ralpson on matlab
You could try something like this: function root = newtonR(f,fp,tol) for k=1:3 x=input('root guess'); if ~isinf(1/fp...

3 days ago | 0

Solved

Connect Four - 01
Connect four is a two player board game. <https://en.wikipedia.org/wiki/Connect_Four> Given a complete connect-four board,...

4 days ago

Solved

Connect Four - 02
Previous Problem <https://www.mathworks.com/matlabcentral/cody/problems/45354-connect-four-01> In addition to previous proble...

4 days ago

how can I get successive maximum value from this code?
Why not index B and x? Otherwise, you are overriding their values each time the loop is run. For i =5, max ([70 50]) = 70! Not s...

6 days ago | 0

| accepted

Solved

Kissing Circles-01
Three circles are mutually tangent to each other and also to a line. find the radius of the smallest circle. The radius of th...

6 days ago

Solved

Number generator
In this problem, a number will be given. starting with the first digit, keep on adding all subsequent digits till the state (...

6 days ago

Solved

modular arithmetic
Given three integers a,b and c, find the remainder when a^b is divided by c. Here, a^b will be well beyond the largest 64 bit in...

7 days ago

Solved

grazing cows
Here is a fun problem I encountered in high school. Two cows are grazing in an enclosed square-shaped field of side length s ...

7 days ago

Solved

Big Integer Sqrt
You will be given a big integer, you should return the square root of it. input: '16' output: '4' have fun!

8 days ago

Solved

Cat's paw - 01
lets imagine a cat, standing on an infinitely long row of tiles. since its a 'cat', string length=3; it takes 3 tiles to stand. ...

8 days ago

Solved

Area-07
This is a follow up of the problem <https://www.mathworks.com/matlabcentral/cody/problems/45341-area-06> in this case, fi...

8 days ago

Solved

Grazing-02
A cow is tied to an outside corner of a rectangular barn of size (a,b) with a rope of length l. What is the maximum area the cow...

8 days ago