Azzera filtri
Azzera filtri

matlab problem

2 visualizzazioni (ultimi 30 giorni)
AMAL OUNARA
AMAL OUNARA il 19 Mag 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

Risposta accettata

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

Più risposte (2)

AMAL OUNARA
AMAL OUNARA il 19 Mag 2011
thanks a lottttttttt it really works now wonderful
good luck

AMAL OUNARA
AMAL OUNARA il 19 Mag 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 ????

Categorie

Scopri di più su Arduino Hardware in Help Center e File Exchange

Tag

Non è stata ancora inserito alcun tag.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by