Clear Filters
Clear Filters

Writing math formula into the matlab

1 view (last 30 days)
hamed
hamed on 19 Jul 2016
Commented: Thorsten on 19 Jul 2016
I try to write the below formula:
h=sum(H1(l*m)^r);
Is that true in your opinion?
Thanks for the help.
  2 Comments
hamed
hamed on 19 Jul 2016
This is my H Matrix in another function, that I will use this function into the another function:
function [H1,c,s,path,d,m]=topology1(topo) if (strcmp(topo,'access')) % This is for access-core H=zeros(24,18,3); H1=zeros(size(H,1),size(H,2),3); H1(:,:,1) = H(:,:,1);
So, I use the above function in below function:
function TrumpNew(topo,w) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This program solves the problem of Utility-Exp_cost with Trump by He et. % Today is 27 ,July %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% [H1,c,ms,path]=topology1(topo); [l,r,m]=size(H1); maxc=max(c);
beta_p=1e-4; gamma=0.1; z1=(maxc/r)*ones(r,1); % initial the flow rate y=H1*z1; % initial the efficent capacity for the link / Why we don't z2=zeros(r,1); h=sum(H1(l*m)^r);
Cheers

Sign in to comment.

Accepted Answer

Thorsten
Thorsten on 19 Jul 2016
It depends on the context, but your code is probably wrong. You have some variable H that seems to vary according to i, l and j. If you have set up your H such that l varies along a column, you can write
h = sum(H)
where j and l could are varying along the 2nd and 3rd dimension.
  2 Comments
hamed
hamed on 19 Jul 2016
Thanks a lot for your answer. Actually, the H matrix is:
[l,r,m]=size(H1);
Which, I want to map r as i and m as j. In this case, could it be written as you have mentioned?
Cheers
Thorsten
Thorsten on 19 Jul 2016
Yes. sum sums over the first dimension, which is l in your case. And that's what the formula says.
BTW:
S = sum(X,DIM) sums along the dimension DIM.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!