Community Profile

# David Hill

##### Last seen: Today
1.649 total contributions since 2017

View all

Contributions in
View by

using MATLAB determine the unit vector normal to 𝐒=𝐱𝟐+𝐲𝟐−𝐳 at point P(1,3,0).
syms x y z s = x^2+y^2-z; n(x,y,z) = gradient(s, [x, y, z]); a = eval(n(1,3,0)/norm(n(1,3,0)));

alrededor de 2 horas ago | 0

| accepted

How can i solve this?
a=mean(abs(A),'all'); s=sum(A>a,'all');

alrededor de 2 horas ago | 0

| accepted

Why does MATLAB do this?
floating point error isequal(round(transpose(inv(A)),15),round(inv(transpose(A)),15));

alrededor de 3 horas ago | 1

| accepted

calling subfunctions multiple times
function problem5(n) k=0:20;%method1 gets very slow causing the function to take a few minutes for low values of n=3 for i=k ...

alrededor de 3 horas ago | 1

| accepted

How do I correctly enter the function f(x,y)=sin((pi/2)*(x+y))?
f=@(x,y)sin(pi/2*(x+y)); [X,Y]=meshgrid(-1:.2:1);%not sure what step size you are using a=interp2(X,Y,f(X,Y),1/3,1/3);

alrededor de 3 horas ago | 0

Picking the right combination from the arrays
Not sure how you are getting your data. Generally, you would not want to use so many variables but rather index into a single va...

alrededor de 11 horas ago | 0

How can I convert this cell array into a matrix?
reshape(cell2mat(C),60,[])';

alrededor de 11 horas ago | 0

Splitting up arrays in for loops
n=[0,find(diff(M(:,3))>1),size(M,1)]; for k=1:length(n)-1 m{k}=M(n(k)+1:n(k+1),:); end

alrededor de 11 horas ago | 0

| accepted

Submitted

Secure Off-line Email Encryption GUI
Send and receive off-line encrypted emails using public-key cryptography and Advanced Encryption Standard (AES).

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...

6 días ago | 0

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

6 días 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...

8 días 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);

9 días 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...

9 días 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,[])';

10 días 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

10 días 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);

10 días ago | 0

| accepted

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

10 días 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));

16 días 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...

17 días 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...

17 días 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,...

21 días 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./(...

21 días 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

21 días ago | 0

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

22 días ago | 0

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

22 días 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...

22 días 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...

22 días ago | 0