MATLAB: How to compose a function n-times and want value for a particular value of n functionsMATLAB Compilermatlab function Suppose f(x)=x^2+1. Composition of two f, I mean f(f(x)), Similarly composition of 3 f is f(f(f(x))). n-th composition of f is denoted by f^n(x). What is the general command to evaluate f^10(2) ? Best Answer f = @(x) x.^2-x;n = 10;x = 1/pi;y = x;for k=1:n y = f(y)end% y is f^10(x) Related SolutionsMATLAB: Issue with data format when using textscan() The format should be all lower case for duration.%{hh:mm:ss}THowever, the data appears to be delimited as semicolon. You'd have more luck with readtable:opts = detectImportOptions('D:\SI010118.txt')opts = setvartype(opts,1,'datetime')opts = setvaropts(opts,1,'InputFormat','dd.MM.uuuu HH:mm:ss')readtable('D:\SI010118.txt',opts) MATLAB: What is the wrong in this We would need to see the code to be sure, but probably f(x) is a symbolic expression that involves indexing a variable at a position that does not exist. Related QuestionHelped needed in Fibonacci Sequence codeWhat is the error in this codeFunctions with different conditionsHow to use datetick for this codeI want to write a code where equation is y=x*x. if y=100 what is the value of x
Best Answer