Function only computing first element of array used as input
Ältere Kommentare anzeigen
I am trying to use a MATLAB function to generate a plot for the function :

As such I am using the linspace function to generate an input array that I then aim to give to the function i wrote to get data to be plotted. But the function only processes the first element of the Array generated by linspace. The function appears to work correctly for singular values but not for arrays.
function S = FXSUM(x)
Tot = 0; % reset Total
for n = 2:x % for loop for Function Summs at a iterations
it = (1/(n*((log(n))^2))); % provided function
Tot = Tot + it % sum of function iterations
end
S = Tot; % Out value equal to function iterrations total
end
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!