Filter löschen
Filter löschen

matlab problem

2 Ansichten (letzte 30 Tage)
AMAL OUNARA
AMAL OUNARA am 19 Mai 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

Akzeptierte Antwort

Franck Dernoncourt
Franck Dernoncourt am 19 Mai 2011
You probably meant "X=(Fint(i)-RFexp(i)).^2".

Weitere Antworten (2)

AMAL OUNARA
AMAL OUNARA am 19 Mai 2011
thanks a lottttttttt it really works now wonderful
good luck

AMAL OUNARA
AMAL OUNARA am 19 Mai 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 ????

Kategorien

Mehr zu Arduino Hardware finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by