Community Profile

# David Hill

##### Last seen: Today
4,287 total contributions since 2017

View all

Contributions in
View by

Block diagonal change the first and last blocks with some other matrices
Why not use blkdiag() function? T=blkdiag(B,C,B);

9 minutes ago | 0

Solved

Nuclear Binding Energy
Compute the approximate nuclear binding energy in MeV using the least-squares fit of the semi-emirical mass formula. Round to th...

15 hours ago

Problem

Nuclear Binding Energy
Compute the approximate nuclear binding energy in MeV using the least-squares fit of the semi-emirical mass formula. Round to th...

15 hours ago | 0 | 1 solver

how to get xyz value
rgb2xyz(RGB)

22 hours ago | 0

Convert decimal to ASCII
uint8(['SO:VO ',num2str(voltage)]);

23 hours ago | 0

| accepted

Problem with code-beginner
distances = zeros(length(xx),length(yy),NumberOfSites); xshift = isd*sind(AngleDistance*((1:NumberOfSites)-1));%assume isd and ...

23 hours ago | 0

| accepted

How to write a program that selectively picks hexadecimal values from a text file based on bit size?
r=randi(4); a=readcell('hextest.txt'); x=input('hex length: '); hexValue=a{log2(x/16)+1,r};

24 hours ago | 1

| accepted

Solved

Bleed non-zeros to the right
What a title! Yet, it says what I mean. You get a vector, some values and a lot of zeroes. Every zero is replaced by the firs...

2 days ago

Solved

Juego de posiciones
Crea una función que ordene vectores de tal manera que los primeros números sean negativos ordenados de menor a mayor. Y después...

2 days ago

Solved

Construcción de matrices a partir de vectores
Construye la matriz A=[1 2 2 1; 2 2 3 3;2 3 3 4; 1 3 4 4] utilizando los siguientes vectores. c=[1 2 3 4]; d=[2 3 4]; b...

2 days ago

Solved

Construyendo matrices parte 2
Construye la siguiente matriz a partir de otros tres vectores/matrices. [ 1 8 15 3 3 3 3 2 9 16 3 3...

2 days ago

Solved

Determina el número de cifras de un número
Crea una función que te devuelva el número de cifras de un número. Algunos ejemplos para ayudarte serían: El número 125 tie...

2 days ago

How do I perform prelocation when creating an array using a for loop?
speedvalue=160; Vcruise=zeros(1,speedvalue); HPreq=zeros(1,speedvalue); for i=1:1:speedvalue Vcruise(i)=i; Ptotal_fw...

2 days ago | 0

| accepted

Solved

Capitilize the first letter of every word in a string
For a given input string, capitalize every letter at the beginning of a word, and transform the rest of the letters to lower-cas...

6 days ago

Solved

Create a function that returns an array P the same size as X and Y containing the element-by-element, four-quadrant inverse tang...

6 days ago

Solved

surface of parallelogram
Given 2 vectors of each 3 elements, determine the surface of the parallelogram which can be created from these 2 vectors.

6 days ago

Solved

Generalized Fibonacci
The Fibonacci sequence is defined as: Fib(1) = 0 Fib(2) = 1 Fib(N) = Fib(N-1) + Fib(N-2) The Fibonacci sequence ca...

6 days ago

How can I use arrayfun and integral as anonymous function?
I am doing a little guessing. I assume you want to integrate with respect to s (0,t) then look at t from 0:0.1:1. syms s t v=0...

6 days ago | 1

Solve Nonlinear complex equation
syms c1 c2 c3 c4 c5 c6 x1 x2; eqn=c1*exp(1i*x1)+c2*exp(1i*c3)-c4*exp(1i*c5)+x2*exp(1i*c6)==0; a=solve(eqn,x1); b=solve(eqn,x2...

7 days ago | 0

Converting Struct field to array
MyMatrix=cell2mat(struct2cell(MyStruct));

7 days ago | 0

Could someone please explain what is wrong in my function?
Why not just use built-in function sign()? a=sign(A); %then index into a for specific element

7 days ago | 2

How to sum specific elements of a matrix
m=randi(100,6);%your assumed matrix m=[m;mean(m([1 4],:));mean(m([2 5],:));mean(m([3 6],:))]; b=[mean(m(:,[1 4]),2),mean(m(:,[...

7 days ago | 0

How do I correct the error "Matrix dimensions must agree"?
Your problem is with the norm() function. You cannot subtract at 4x1 vector from a 5x1. Maybe you ment: for i=1:length(k), e(i)...

8 days ago | 0

| accepted

Initializing 1/2 of a row with one value and the other half with another
You are concatenating two arrays. Look at the ones() and zeros() functions. a=ones(1,5); b=zeros(1,6); c=[a,b];

8 days ago | 0

| accepted

Find the indices of the imaginary element of the matrix
Lidx=find(imag(A)~=0);

8 days ago | 0

| accepted

How to make the code efficient?
n=10; [x,y]=meshgrid(0:n-1); idx=mod(y.^2-x.^3-2*x-3,n)==0; xy_mtx=[x(idx),y(idx)];

8 days ago | 1

How do i create a table with increments of occurrences of a value based on another column?
x= [1,2,3,4,5,1,3,4,6,5,1,3]; y=unique(x); z=ones(size(x)); for k=y a=find(x==k); z(a)=1:length(a); end

8 days ago | 0

Create an string array with strings having both char and numbers
k=[]; for n=1:25; k=[k,string(sprintf('Analysis_%d',n))]; end

8 days ago | 1

| accepted

Indexing vectors in a cell matrix with for loops?
newmat=zeros(1500,8) for k=1:8 t=yourCell{k}(1:3,:); t=t'; newmat(:,k)=t(:); end

9 days ago | 0

Solved

Generate a vector which contains a pyramid pattern (★★★★)
Generate a vector that contains terms that follows a pyramid pattern up to the nth row: 1 2 2 3 3 3 4 4 4 4 ...

9 days ago