How can i do the average between two cells of two matrices?
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
Hi! I am having some serious issues with this problem. I am creating N=250 x,z coordinates. The odd N coordinates correspond to p1 and the even N coordinates correspond to p2. Once I have arrays of p1 and p2 I want to create p which is the average between p1 and p2 coordinates. I cant find the right code to create this array p(250,2) which is the average of both point p1 and p2. Also, N is the number of panels and p1 and p2 are the points where the panels connect and p is the point in the centerline of the panel.
Thank you very much for your help
clc
clear
NACAin=2405;
NACA=num2str(NACAin);
alpha=(5*pi/180);
N=250;
global x
global z
panelgen(NACA,250,alpha); %this generates coordinates x and z, which are two (250,1) arrays
global c
p1=zeros(250,2);
p2=zeros(250,2);
for i=1:N
c=evenorodd(i);
if c==1; %odd
p1(i,:)=[x(i),z(i)];
elseif c==0; %even
p2(i,:)=[x(i),z(i)];
end
p(i,:)=(p1(i,:)+p2(i,:))/2; <---
end
3 comentarios
Azzi Abdelmalek
el 30 de Mzo. de 2014
Post a short example, and make the question clear and breve
Jacob
el 30 de Mzo. de 2014
Azzi Abdelmalek
el 30 de Mzo. de 2014
Respuestas (0)
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!