CCT(2,3,2,3)
sum =
0
0
Error in RCT3 (line 2)
syms t r theta phi p(r) q(r) a
Output argument "R" (and maybe others) not
assigned during call to "C:\Users\Shiraz
Khan\Documents\MATLAB\RCT3.m>RCT3".
Error in CCT (line 13)
sum=sum+g(i,m)*RCT3(j,k,l,m);

2 件のコメント

Geoff Hayes
Geoff Hayes 2018 年 7 月 10 日
shiraz - can you share the code for RCT3.m? Given the error message, the R output parameter is not being set given your inputs.
Geoff Hayes
Geoff Hayes 2018 年 7 月 11 日
Shiraz's answer moved here
function [R]= RCT3(i,j,k,m)
syms t r theta phi p(r) q(r) a
g=[exp(p(r)) 0 0 0; 0 -exp(q(r)) 0 0; 0 0 -r^2 0; 0 0 0 -r^2*(sin(theta))^2];
x= [t r theta phi];
A=diff(SRH2(i,k,m),x(1,j));
% pretty(A)
B=diff(SRH2(i,j,m),x(1,k));
% pretty(B);
sum1=0;
for n=1:4
sum1=sum1+SRH2(i,k,n)*SRH2(n,j,m);
end
sum1;
% pretty(sum1)
sum2=0;
for n=1:4
sum2=sum2+SRH2(i,j,n)*SRH2(n,k,m);
end
sum2;
% pretty(sum2)
sum=A-B+sum1-sum2;
sum;
pretty(sum)
end

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

 採用された回答

Geoff Hayes
Geoff Hayes 2018 年 7 月 11 日

0 投票

Shiraz - your function signature is
function [R]= RCT3(i,j,k,m)
which means that the output parameter from your function is named R and so you must initialize a local variable (within your code) with that same name. If you don't do this, then you will get the Output argument "R" (and maybe others) not assigned during call.
Perhaps this is the sum local variable in your code? If it is, then rename it to R. If it isn't, then rename it anyway since it will conflict with the MATLAB built-in function sum.

その他の回答 (0 件)

タグ

質問済み:

2018 年 7 月 10 日

回答済み:

2018 年 7 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by