SlideShare uma empresa Scribd logo
1 de 1
Baixar para ler offline
2. Algorithm implementation: Write a MATLAB program to compute the square root using the
following algorithm: y(n) = x(n) - y^2(n - 1) + y(n - 1). Show that the output y(n) of this system
for an input x(n) = alpha u(n) with y(-1) = 1 converges to as n
Solution
%MATLAB PROGRAM FOR CHEGG
%y(n)=x(n)-y^2(n-1) + y(n-1)
%Here n is the input to the function
%Assyming x(n) = n
%y(n) is the square root of n
function result=f(n)
if(n>=0)
result=n-(f(n-1))^2 +f(n-1);
end
end
%Error function
for n=1:10000
error=f(n)-sqrt(n);
end

Mais conteúdo relacionado

Mais de ahmedmodassir

2. A pond is stocked with 100 fish in 1997, and it is observed that t.pdf
 2. A pond is stocked with 100 fish in 1997, and it is observed that t.pdf 2. A pond is stocked with 100 fish in 1997, and it is observed that t.pdf
2. A pond is stocked with 100 fish in 1997, and it is observed that t.pdfahmedmodassir
 
2) (S-poin errors are systematic or random in nature. ts) List 5 .pdf
 2) (S-poin errors are systematic or random in nature. ts) List 5 .pdf 2) (S-poin errors are systematic or random in nature. ts) List 5 .pdf
2) (S-poin errors are systematic or random in nature. ts) List 5 .pdfahmedmodassir
 
13. Is the following proposition true or false Justify your conclusi.pdf
 13. Is the following proposition true or false Justify your conclusi.pdf 13. Is the following proposition true or false Justify your conclusi.pdf
13. Is the following proposition true or false Justify your conclusi.pdfahmedmodassir
 
141. Which of the following statements is true A. U.S non- fin.pdf
 141. Which of the following statements is true A. U.S non- fin.pdf 141. Which of the following statements is true A. U.S non- fin.pdf
141. Which of the following statements is true A. U.S non- fin.pdfahmedmodassir
 
12. Find the transition matrix from the basis B to the basis c where .pdf
 12. Find the transition matrix from the basis B to the basis c where .pdf 12. Find the transition matrix from the basis B to the basis c where .pdf
12. Find the transition matrix from the basis B to the basis c where .pdfahmedmodassir
 
12. Let U be a nonempty set and let P(U) be the power set of U. That .pdf
 12. Let U be a nonempty set and let P(U) be the power set of U. That .pdf 12. Let U be a nonempty set and let P(U) be the power set of U. That .pdf
12. Let U be a nonempty set and let P(U) be the power set of U. That .pdfahmedmodassir
 
1.) Prepare contribution margin income statement at sales level o.pdf
 1.) Prepare contribution margin income statement at sales level o.pdf 1.) Prepare contribution margin income statement at sales level o.pdf
1.) Prepare contribution margin income statement at sales level o.pdfahmedmodassir
 
1. What is the difference between law and morality 2. What are .pdf
 1. What is the difference between law and morality  2. What are .pdf 1. What is the difference between law and morality  2. What are .pdf
1. What is the difference between law and morality 2. What are .pdfahmedmodassir
 
1. What is the purpose of criminal law 2. What are the various c.pdf
 1. What is the purpose of criminal law 2. What are the various c.pdf 1. What is the purpose of criminal law 2. What are the various c.pdf
1. What is the purpose of criminal law 2. What are the various c.pdfahmedmodassir
 

Mais de ahmedmodassir (9)

2. A pond is stocked with 100 fish in 1997, and it is observed that t.pdf
 2. A pond is stocked with 100 fish in 1997, and it is observed that t.pdf 2. A pond is stocked with 100 fish in 1997, and it is observed that t.pdf
2. A pond is stocked with 100 fish in 1997, and it is observed that t.pdf
 
2) (S-poin errors are systematic or random in nature. ts) List 5 .pdf
 2) (S-poin errors are systematic or random in nature. ts) List 5 .pdf 2) (S-poin errors are systematic or random in nature. ts) List 5 .pdf
2) (S-poin errors are systematic or random in nature. ts) List 5 .pdf
 
13. Is the following proposition true or false Justify your conclusi.pdf
 13. Is the following proposition true or false Justify your conclusi.pdf 13. Is the following proposition true or false Justify your conclusi.pdf
13. Is the following proposition true or false Justify your conclusi.pdf
 
141. Which of the following statements is true A. U.S non- fin.pdf
 141. Which of the following statements is true A. U.S non- fin.pdf 141. Which of the following statements is true A. U.S non- fin.pdf
141. Which of the following statements is true A. U.S non- fin.pdf
 
12. Find the transition matrix from the basis B to the basis c where .pdf
 12. Find the transition matrix from the basis B to the basis c where .pdf 12. Find the transition matrix from the basis B to the basis c where .pdf
12. Find the transition matrix from the basis B to the basis c where .pdf
 
12. Let U be a nonempty set and let P(U) be the power set of U. That .pdf
 12. Let U be a nonempty set and let P(U) be the power set of U. That .pdf 12. Let U be a nonempty set and let P(U) be the power set of U. That .pdf
12. Let U be a nonempty set and let P(U) be the power set of U. That .pdf
 
1.) Prepare contribution margin income statement at sales level o.pdf
 1.) Prepare contribution margin income statement at sales level o.pdf 1.) Prepare contribution margin income statement at sales level o.pdf
1.) Prepare contribution margin income statement at sales level o.pdf
 
1. What is the difference between law and morality 2. What are .pdf
 1. What is the difference between law and morality  2. What are .pdf 1. What is the difference between law and morality  2. What are .pdf
1. What is the difference between law and morality 2. What are .pdf
 
1. What is the purpose of criminal law 2. What are the various c.pdf
 1. What is the purpose of criminal law 2. What are the various c.pdf 1. What is the purpose of criminal law 2. What are the various c.pdf
1. What is the purpose of criminal law 2. What are the various c.pdf
 

Último

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 

Último (20)

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 

2. Algorithm implementation Write a MATLAB program to compute the sq.pdf

  • 1. 2. Algorithm implementation: Write a MATLAB program to compute the square root using the following algorithm: y(n) = x(n) - y^2(n - 1) + y(n - 1). Show that the output y(n) of this system for an input x(n) = alpha u(n) with y(-1) = 1 converges to as n Solution %MATLAB PROGRAM FOR CHEGG %y(n)=x(n)-y^2(n-1) + y(n-1) %Here n is the input to the function %Assyming x(n) = n %y(n) is the square root of n function result=f(n) if(n>=0) result=n-(f(n-1))^2 +f(n-1); end end %Error function for n=1:10000 error=f(n)-sqrt(n); end