Community Profile

# David Hill

484 total contributions since 2017

#### David Hill's Badges

View all

Contributions in
View by

Create a matrix from some given matrices
As long as the size of matrices A,B,and C are the same, creating new matrix as listed above is as simple as the following. newM...

17 hours ago | 0

find magnitude of approximate percent relative error
a=(-1).^k.*(x.^(2*k+1)./factorial(2*k+1)); MagTrueerr=abs(cumsum(a)-f_exact); MAPRE=100*MagTrueerr./cumsum(a); No loops neede...

2 days ago | 0

function results into a vector
You just need a dot! Vreg = [(230-(VL))./(VL)];

2 days ago | 0

Adding number in a sequence
movsum(jj,2);

2 days ago | 0

How tatement to use if statement to eliminate unwanted value
m=max(i(i~=Inf));

2 days ago | 0

| accepted

HOW TO get answer in 6 decimal places .
format long

2 days ago | 0

| accepted

I can't figure out this matlab function that returns the exponential of each element
function ex = seriesExp(x) i=0:9; ex=arrayfun(@(x)sum(x.^i./factorial(i)),x); end

2 days ago | 0

how to remove the error showing undefined function or variable
Preallocate X1 before the loop. X1=zeros(m1*k2,n1);

2 days ago | 0

| accepted

How do I calculate the square of TStep5 divided by the average of TStep4 and TStep2?
TStep5^2/mean([TStep4,TStep2]); If you explained what you really what to do, it would be easier to help. There is likely a must...

3 days ago | 0

How do I find the sum of two vectors?
Row + Step;

3 days ago | 0

How would I convert this equation to code? My likely flawed coding is below. Thanks!
Assuming L and T are vector arrays of equal length and all others are defined constants. es=e0*exp((L/rv).*(1/t0 - 1./T));

3 days ago | 0

How can I create multiple arrays, based on unique column values, from a single array?
For your array x: function Plot(x) hold on; z=x(:,1); arrayfun(@(y)plot(x(ismember(z,y),3),x(ismember(z,y),2),'Marker','*','...

3 days ago | 0

backward recurssion in a loop
c=zeros(9,20); c(9,:)=b(9,:)-a(9,:); for i=8:-1:1 c(i,:)=c(i+1,:)-a(i,:); end

3 days ago | 0

| accepted

help plotting basic x vs y?
x =linspace(0,L,100); y =w0./(120*E*I*L)*(-5*x.^4+6*L^2*x.^2-L^4); plot(x,y);

3 days ago | 0

| accepted

correlation coefficients for a matrix that includes NaNs
[R,P]=corrcoef(rmmissing(PK6mab)); If you can tolerate deleting the entire rows of any missed data.

3 days ago | 0

Solved

Tell me the slope
Tell me the slope, given a vector with horizontal run first and vertical rise next. Example input: x = [10 2];

3 days ago

Solved

Sum of diagonal of a square matrix
If x = [1 2 4; 3 4 5; 5 6 7] then y should be the sum of the diagonals of the matrix y = 1 + 4 + 7 = 12

3 days ago

Sorting Prime Numbers From an Array of Numbers, Into a New Array
Why not use the primes function? NN=primes(100);

3 days ago | 0

Return if No Solution
If A will always be a square matrix, then if the det(A)==0 then return (no solution).

10 days ago | 0

Solved

Must be in the front row...
You are given a matrix followed by a single number. Your object is to write a script that will shift the matrix around so that ...

10 days ago

Solved

Approximation of Pi (vector inputs)
Pi (divided by 4) can be approximated by the following infinite series: pi/4 = 1 - 1/3 + 1/5 - 1/7 + ... For a given numbe...

10 days ago

Solved

Approximation of Pi
Pi (divided by 4) can be approximated by the following infinite series: pi/4 = 1 - 1/3 + 1/5 - 1/7 + ... For a given numbe...

10 days ago

Solved

Generate Square Wave
Generate a square wave of desired length, number of complete cycles and duty cycle. Here, duty cycle is defined as the fraction ...

10 days ago

Solved

Sum of series VII
What is the sum of the following sequence: Σ(km^k)/(k+m)! for k=1...n for different n and m?

10 days ago

Solved

Sum of series VI
What is the sum of the following sequence: Σk⋅k! for k=1...n for different n?

10 days ago

Solved

Sum of series V
What is the sum of the following sequence: Σk(k+1) for k=1...n for different n?

10 days ago

Solved

Sum of series IV
What is the sum of the following sequence: Σ(-1)^(k+1) (2k-1)^2 for k=1...n for different n?

10 days ago