nested for loop for array manipulation
Mostrar comentarios más antiguos
I want to form an array and put each value from that array in an equation and get all ppossible values fir that equation. then put into another function to get answer by trapezoidal rule and multiply each respectful value with a different set of array and add all of those values
clc;
x=1;
n=2;
s=0;
z=1;
for i=2:10;
x(i)=x(i-1)./1.25;
g=x./4;
a=-(x./2);
b=x./2;
h=(b-a)/n;
y=(1./sqrt(2.*pi).*g).*exp(-x(i).^2./(2.*(g.^2)));
CLF = hypot(diff(x), diff(y)); % Calculate integrand from x,y derivatives
CL = trapz(CLF) % Integrate to calculate arc length
for j=2:10;
z(j)=z(j-1)./1.25;
surf=CL*z(j);
end
s=s+CL;
end
a=disp(a)
b=disp(b)
g=disp(g)
X=disp(x)
Y=disp(y)
Z=disp(z)
S=disp(s)
Surf=disp(surf)
plot(X,Y)
%just put length in 3rd dimension
Here is my current code.
Thank you all!
Respuestas (0)
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!