Greetings everyone, I am trying to create a function (without using loops) called LeibnizT that generates a row vector with the first n terms of the Leibniz series, the input argument is just n. My code is attached, thanks!
function y=LeibnizT(n) y=(-1).^n/(2.*n+1) end
NOTE:-
Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help , Finance Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.
Think about it. How does that generate a VECTOR? In what you wrote, is n a SCALAR? (Yes)
y=(-1).^n/(2.*n+1)
So how will that create a vector as a result?
What tools can you think of that generate a vector, that do not have a for loop or a while loop? Surely you can think of some tools that will return a vector? In fact, that vector needs to be of length n. Take a shot. Show us what you can think of that gets you closer to what you need.
SEE COMPLETE ANSWER CLICK THE LINK
Comments
Post a Comment