필터 지우기
필터 지우기

How to solve this loop equation

조회 수: 1 (최근 30일)
Manish Kumar
Manish Kumar 2019년 3월 13일
댓글: Manish Kumar 2019년 3월 13일
Dear All,
I have successfully executed the following equation for single value of a and corresponding single b value, while m varies from 0 to 1 with increment of 0.01.
m = 0:0.01:1;
eff= ((0.65.*(a-m-0.3).*b))./10;
xlswrite ('1.xlsx',[m(:),eff(:)]);
However i have a lots of data in a and coresponding b. 1st column of excel sheet is a and second column is b. How to do it and store in excel sheet.
Excel sheet should like
a m eff
1 0.01 xxxx
1 0.02 xxxx
1 0.03 xxxx
......................
1.01 0.01 xxxx
1.01 0.02 xxxx
You can see a is with increment of 0.01 and corresponding b value is given. Thank you

채택된 답변

Andrei Bobrov
Andrei Bobrov 2019년 3월 13일
편집: Andrei Bobrov 2019년 3월 13일
data = readtable('data.xlsx','ReadV',0);
data.Properties.VariableNames = {'a','b'};
m = 0:.01:1;
[ii,idx] = ndgrid(m,1:height(data));
eff = 0.065*data.b(idx(:)).*(data.a(idx(:)) - ii(:) - 0.3);
T = array2table([data.a(idx(:)),ii(:),data.b(idx(:)),eff],...
'V',{'a','m','b','eff'});
writetable(T,'data_out.xlsx');
  댓글 수: 1
Manish Kumar
Manish Kumar 2019년 3월 13일
Perfect. Thank you very much sir.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by