how can i use table after a function?
3 ビュー (過去 30 日間)
古いコメントを表示
how can i use a table in this function?
T=table(P','VariableNames',{'Power'});
disp(T);
disp('Arian');
clear all
clc
L0 = 6.0;
L = fzero(@fun,L0) %show the final Lambda
function res = fun(L)
B = [7.20; 7.85; 7.98; 7.10; 7.30; 6.90; 8.01; 7.30; 7.42; 7.16];
C = [0.00142; 0.00194; 0.00482; 0.00321; 0.00210; 0.00178; 0.00212; 0.00350; 0.00267; 0.00390];
D = [0.0000001; 0.0000002; 0.0000003; 0.0000001; 0.0000002; 0.0000003; 0.0000001; 0.0000002; 0.0000003; 0.0000001];
Pmin =[150; 100; 50; 50; 100; 100; 100; 100; 100; 100];
Pmax =[600; 400; 200; 200; 350; 500; 300; 300; 300; 300];
Pr = 2500;
c=B-L;
b=2*C;
a=3*D;
delta=b.^2-(4*a.*c);
P=(-b+sqrt(delta))./(2*a);
P(P<Pmin) = Pmin(P<Pmin);
P(P>Pmax) = Pmax(P>Pmax);
Pt=sum(P);
res=Pr-Pt;
end
2 件のコメント
Rik
2022 年 12 月 1 日
The variable name v doesn't actually occur anywhere in your code. What exactly do you want to happen?
採用された回答
Rik
2022 年 12 月 3 日
You can make P a second output of your function. That way you can call it with the final value of L and extract what you want.
If that doesn't solve your problem you will have to explain in more detail what exactly you want to happen.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!