フィルターのクリア

matlab problem

2 ビュー (過去 30 日間)
AMAL OUNARA
AMAL OUNARA 2011 年 5 月 19 日
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

採用された回答

Franck Dernoncourt
Franck Dernoncourt 2011 年 5 月 19 日
You probably meant "X=(Fint(i)-RFexp(i)).^2".

その他の回答 (2 件)

AMAL OUNARA
AMAL OUNARA 2011 年 5 月 19 日
thanks a lottttttttt it really works now wonderful
good luck

AMAL OUNARA
AMAL OUNARA 2011 年 5 月 19 日
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 ????

カテゴリ

Help Center および File ExchangeArduino Hardware についてさらに検索

タグ

タグが未入力です。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by