Community Profile

David Hill

Last seen: Today
1.640 total contributions since 2017

View all

Contributions in
View by

Differentiation and integration of functions
syms x; y=(11*x+1)/sqrt(x^2+22); dy=diff(y); ddy=diff(dy); for x=1:3 Dy(x)=double(subs(dy)); DDy(x)=double(subs(dd...

4 giorni ago | 0

How to get the matrix when I need a logic matrix
QQQQ=AAAA.*y;

4 giorni ago | 0

| accepted

Interpolation between intersecting curves
f=fit(x1',y1','poly5'); g=fit(x2',y2','poly5'); x=min(x2):.01:max(x2); h=1/4.5*(g(x)-f(x))+f(x);%only good for minimum x-rang...

5 giorni ago | 0

how to write the expression ((pi*epsilon)/ln((D-r)/r)) in matlab?
Are all the variables arrays of equal size? If so, then you need the element-wise operator. c = (pi*epsilon)./log((D-r)./r);

7 giorni ago | 0

Trapezodial Method using while loop
f=@(x) sin(x); tol=1e-6; x=linspace(0,pi,2); A=sum(movsum(f(x),2,'Endpoints','discard')/2.*diff(x)); n=2; while abs(2-A)>=t...

7 giorni ago | 0

how to reshape the matrix
m =[0 0 1 0 0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 1 1]; a=reshape(m,3,[])';

7 giorni ago | 1

| accepted

Caesar cryptic function problem.
Assuming c is a double array function coded = caesar(c,n) coded=char(mod(c-32+n,95)+32); end

7 giorni ago | 0

How to compare two matrices, row by matrix using the GPU
Not sure if something like this would work for you. arrayfun(@(x)ismember(a,b(x,:)),1:size(b,1),'UniformOutput',false);

8 giorni ago | 0

| accepted

Vector of n elements
a=1:n; A=a.*(a+1)/2;

8 giorni ago | 0

How do i finish the code. I'm not even sure if this is how one would start to run the code
x=randi([-10,10]); while x(end)~=9; x=[x,randi([-10,10])]; end display(x(x>0&mod(x,2)==0));

13 giorni ago | 0

| accepted

my code wont run. was required to write a code to add charecters an store then in array
function x=AccuSumNet(n) for k=1:length(n) x(k)=sum(n{k}-'0'); end end AccuSumNet({'1234567891011121314151617181920...

14 giorni ago | 0

| accepted

How can I code this Newton-Raphson and Secant Methods?
The basic code is as follows. You can do other checks as desired.Your code looked ok, except you don't need symbolic variables a...

15 giorni ago | 1

| accepted

integral with vectoric varying coeficient
Why not do it after computing the integral since it is a constant. fun = @(x)coef_vec*exp(-x.^2).*log(x).^2; q = integral(fun,...

18 giorni ago | 0

How to write a function ?
y=-sin(x/15)*1000./((x-90).^2+(y-110).^2+60)+sin(x/30)*500./((x-55).^2+(y-55).^2+30)+80./(12+abs(x-15))+60./(12+abs(x-20))+80./(...

18 giorni ago | 0

| accepted

mathematical equation into matlab
t = (2*L.^2)./(5*I.^2.*H.^2*sqrt(2*g)).*H^(5/2);%assuming I, L, H are same size arrays and g is scalar

19 giorni ago | 0

How to set X&Y axis linear in weibull plot
ax=gca; ax.XScale='linear'; ax.YScale='linear';

19 giorni ago | 0

Help me with for loop
a=.1; B=exp(-a*(A-A(1,1)).^2);%comparing all pixels to A(1,1)

19 giorni ago | 0

| accepted

Newton Raphson!but with multiple initial values :/
i = 0; x=[0.5,1.5,2.5]; n = 5; f = @(x)x.^4 - 9*x.^3+29*x.^2-39*x+18; df= @(x)4*x.^3 - 27*x.^2 +58*x -39;%functions s...

19 giorni ago | 2

What is the problem with my bisection calculation ?
m=5; k=0.4; g=9.81; G=m*g; f=@(x)x-k*G; x=[0,0]; while f(x(1))*f(x(2))>=0 x(1)=input('Enter the left hand side of in...

19 giorni ago | 0

error using integral function
Looks like you are trying to do numerical integration, then no need for symbolic variables. f=@(x)exp(-x.^2/2); v=integral(f,1...

20 giorni ago | 0

Plotting random points on a circle
a=2*pi*rand(1,50); b=500*rand(1,50); m=[b.*sin(a);b.*cos(a)];

20 giorni ago | 1

Newton Raphson Method!!!
function x = newton() x=[0.5,1.5,2.5]; f=[1,-9,29,-39,18]; df=polyder(f); for j= 1:5 x = x - polyval(f,x)./polyval(df,x)...

20 giorni ago | 0

| accepted

Performing calculations on a vector
Using elementwise functions and operators. v.^2; v.*m;%v and m same size v./m;%v and m same size v.^m;%va and m same size ....

20 giorni ago | 0

Create a sideways filled in bar plot
Yes, see bar() function

20 giorni ago | 0

change scale of the y-axis
see ylim() function

20 giorni ago | 0

I keep getting error Array indices must be positive integers or logical values.
y=linspace(0,50,100); d=50 mu=.3 ybyd=y/d%y/d% uinfi=10;%u infinity value% for alpha=-3:3 u=(uinfi.*(ybyd+((alpha.*yby...

20 giorni ago | 0

Create a matrix with only the rows indexed by a multiple of N of another matrix.
x2=x1(1:3:length(x1),:);

20 giorni ago | 1

| accepted

help with curve fitting
Use fit() function

20 giorni ago | 0