MATLAB: Calculate sum of series using for forhomeworksum I need help to calculate the sum of this example using only for. Thanks for the help! Best Answer Here is an outline to get you started:a = something; % you put a value herem = something; % you put a value herex = something; % you put a value herey = 0; % the starting y valuefor i=1:m % the for-loop indexing % you put code here to add something to yend % the end of the for-loopSee the Getting Started tutorials here:https://www.mathworks.com/support/learn-with-matlab-tutorials.html Related SolutionsMATLAB: How to start again from the previous step There are for loop and while loop, that can help you do that.http://www.mathworks.com/help/matlab/ref/for.htmlhttp://www.mathworks.com/help/matlab/ref/while.html MATLAB: Extracting values from embedded for loops I think what you really should do is something like:answer1 = zeros(M,N); % pre-allocate variable for x=1:1:M for y=1:1:N z=x*y; answer1(x,y)=z; endendThen you have all the data from each loop iteration.HTH,Arnaud Related QuestionScalar multiplication of a vector
Best Answer