Borrar filtros
Borrar filtros

matlab problem

2 visualizaciones (últimos 30 días)
AMAL OUNARA
AMAL OUNARA el 19 de Mayo de 2011
hello iam new in matlab i have this question: i have ths code to calculate the error between two curves :
function b = fonct(lam)
global Uexp RFexp
%lecture des données expérimentaux
fid =fopen('données expérimentaux.m','r');
M = fscanf(fid,'%e',[1,1]);
xy=fscanf(fid,'%e%e',[2,M]);
xy1=xy';
Uexp=xy1(:,1); %vesteur colonne U2- déplacement
RFexp=xy1(:,2); %vecteur colonne RF2- réaction
mef(lam);
rf4;
Fint=interp1(Uexp,RFexp,-c(:,3),'spline');
b=0;
for i=1:108
X=Fint((i)-RFexp(i)).^2
b=b+X
end
b after runnig it give me this error:
??? Attempted to access Fint(1.99984); index must be a positive integer or logical.
Error in ==> fonct at 16 X=Fint((i)-RFexp(i)).^2 can anyone help me thanks a lot

Respuesta aceptada

Franck Dernoncourt
Franck Dernoncourt el 19 de Mayo de 2011
You probably meant "X=(Fint(i)-RFexp(i)).^2".

Más respuestas (2)

AMAL OUNARA
AMAL OUNARA el 19 de Mayo de 2011
thanks a lottttttttt it really works now wonderful
good luck

AMAL OUNARA
AMAL OUNARA el 19 de Mayo de 2011
hi i have also the same problem when i ake this code : function b = fonct(lam)
global Uexp RFexp
%lecture des données expérimentaux
fid =fopen('données expérimentaux.m','r');
M = fscanf(fid,'%e',[1,1]);
xy=fscanf(fid,'%e%e',[2,M]);
xy1=xy';
Uexp=xy1(:,1); %vesteur colonne U2- déplacement
RFexp=xy1(:,2); %vecteur colonne RF2- réaction
mef(lam);
rf4;
Fint=interp1(Uexp,RFexp,-c(:,3),'spline');
Fsim= - c(:,5);
b=0;
for i=1:45
X=(Fint(i)-Fsim(i)).^2;
b=b+X
end
b
both Fint and Fsim are arrays contains 45 value but the error is :
??? Attempted to access Fint(42); index out of bounds because numel(Fint)=41.
Error in ==> fonct at 17
X=(Fint(i)-Fsim(i)).^2;
what shall i do please ????

Categorías

Más información sobre Arduino Hardware en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by