HI, I am trying to create a function,with an equationas an input so that the equation runs within 4 loops while the values of the equation change with each iteration.
I want to use a function as the process nedds to be repeated for different equations multiiple times.
However matlab does not recognise variable p, i understand it hasnt been defined but im not sure how to input the equation so that it can be read and suitibly substituted in the equation.
I appreciate any assistance thank you
for Sigmainternal = 1:1
sigma11 = stepPQ(N, ((p*p1/(p+p1-1))*((1-(-1)^(q+q1+1))/(q+q1+1))) );
function [sigma] = stepPQ(N,eqn)
for p=0 : N
for q = 0:N
for p1 = 0:N
for q1 = 0:N
temp = (eqn);
temp = 0;
row = p*(N+1)+(q+1);
col = p1*(N+1)+(q1+1);
sigma(row,col) = temp ;
sigma = sigma + transpose(sigma);