how can i use table after a function?
조회 수: 2 (최근 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에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!