facing problem in writing complex programme

7 ビュー (過去 30 日間)
Souvick roy
Souvick roy 2019 年 3 月 20 日
回答済み: Walter Roberson 2019 年 3 月 20 日
Respected sir i have written following matlab programme for formula q2 ,but it shows error. please help me to correct it.
delta=0.02;
beta=0.01;
lamda=[0.01: 0.001 : 0.1];
p= lamda/delta;
part1=beta /lamda(0.5-delta+delta^2);
part2=8 * lamda *sqrt(beta);
part3= sqrt(exp(-1/(2*lamda))-sqrt(exp(-delta/(2*lamda));
part4=part2*(part3);
part5=4 * sqrt(beta)*(1-delta)* exp(-lamda/(2*delta);
part6=(1-delta);
part7=lamda * (exp (-1/lamda)-exp(-delta/lamda));
q2= part1 + part4 + part5 + part6 + part7;
plot(p,q2);
xlabel('p');
ylabel('q2');
formula given below

採用された回答

M
M 2019 年 3 月 20 日
Can you show the entire error message ?
You have at least one error at line 5:
part1=beta /lamda(0.5-delta+delta^2);
saying that "Array indices must be positive integers or logical values." You should refer to this for further information:
Is lambda a function in q2 ?
  1 件のコメント
Souvick roy
Souvick roy 2019 年 3 月 20 日
編集済み: Souvick roy 2019 年 3 月 20 日
Respected sir,
please write this programme.
lamda is a number
q2 depends on lamda value

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 3 月 20 日
you need to vectorize . In particular use ./ instead of /
Matlab does not have implicit multiplication . lambda(0.5 etc) is a request to index lambda not a multiplication .

カテゴリ

Help Center および File ExchangePerformance and Memory についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by