SlideShare une entreprise Scribd logo
1  sur  2
Matlab code required for the following problem:
Y = equation 1, when x is between 0 and a,
Y = equation 2, when x is between a and b
Using for/if/else functions
Need total value of Y from x equals 0 to x = b, using x = [0:0.01:b];
Matlab code required for the following problem:
Y = equation 1, when x is between 0 and a,
Y = equation 2, when x is between a and b
Using for/if/else functions
Need total value of Y from x equals 0 to x = b, using x = [0:0.01:b];
Y = equation 1, when x is between 0 and a,
Y = equation 2, when x is between a and b
Using for/if/else functions
Need total value of Y from x equals 0 to x = b, using x = [0:0.01:b];
Solution
% matlab code
a=input('eter a value') % enter value of a by user
b=input('eter b value')
y1=input(' enter first equation using a and b variables')
y2=input(' enter second equation using a and b variables')
for x=0:0.001:b
for x=0:a
y1;
end
for x=a:b
y2
end
y=y1+y2;
end
y

Contenu connexe

Plus de sngyun4t79

Presented below is information for Wildhorse Corp-- for the year 2025-.docx
Presented below is information for Wildhorse Corp-- for the year 2025-.docxPresented below is information for Wildhorse Corp-- for the year 2025-.docx
Presented below is information for Wildhorse Corp-- for the year 2025-.docxsngyun4t79
 
Practice the following diagnostic statements using your Manual ICD-10.docx
Practice the following diagnostic statements using your Manual  ICD-10.docxPractice the following diagnostic statements using your Manual  ICD-10.docx
Practice the following diagnostic statements using your Manual ICD-10.docxsngyun4t79
 
Potentials Question 15 Unanswered Hypokalemia (low extracellular K+ co.docx
Potentials Question 15 Unanswered Hypokalemia (low extracellular K+ co.docxPotentials Question 15 Unanswered Hypokalemia (low extracellular K+ co.docx
Potentials Question 15 Unanswered Hypokalemia (low extracellular K+ co.docxsngyun4t79
 
Practice Management or Electronic Health Record- As a healthcare profe.docx
Practice Management or Electronic Health Record- As a healthcare profe.docxPractice Management or Electronic Health Record- As a healthcare profe.docx
Practice Management or Electronic Health Record- As a healthcare profe.docxsngyun4t79
 
Prance- Inc-- earned pretax book net income of $941-000 in 2020- Pranc.docx
Prance- Inc-- earned pretax book net income of $941-000 in 2020- Pranc.docxPrance- Inc-- earned pretax book net income of $941-000 in 2020- Pranc.docx
Prance- Inc-- earned pretax book net income of $941-000 in 2020- Pranc.docxsngyun4t79
 
ppl ppl ppl Match each ecosystem-biome with its traditional mone.docx
ppl ppl ppl       Match each ecosystem-biome with its traditional mone.docxppl ppl ppl       Match each ecosystem-biome with its traditional mone.docx
ppl ppl ppl Match each ecosystem-biome with its traditional mone.docxsngyun4t79
 
Prepare Common-size financials for the Balance Sheet and Income Statem.docx
Prepare Common-size financials for the Balance Sheet and Income Statem.docxPrepare Common-size financials for the Balance Sheet and Income Statem.docx
Prepare Common-size financials for the Balance Sheet and Income Statem.docxsngyun4t79
 
Q10- A person has inhaled carbon monoxide CO poisoning- CO has an ext.docx
Q10- A person has inhaled carbon monoxide  CO poisoning- CO has an ext.docxQ10- A person has inhaled carbon monoxide  CO poisoning- CO has an ext.docx
Q10- A person has inhaled carbon monoxide CO poisoning- CO has an ext.docxsngyun4t79
 
Python Create 3 variables named- userName result userNum Prompt the u.docx
Python Create 3 variables named- userName  result userNum Prompt the u.docxPython Create 3 variables named- userName  result userNum Prompt the u.docx
Python Create 3 variables named- userName result userNum Prompt the u.docxsngyun4t79
 
Python coding Question Assume the availability of a function is_prime-.docx
Python coding Question Assume the availability of a function is_prime-.docxPython coding Question Assume the availability of a function is_prime-.docx
Python coding Question Assume the availability of a function is_prime-.docxsngyun4t79
 
Puerto Rico has been devastated by hurricane Maria- Three weeks after.docx
Puerto Rico has been devastated by hurricane Maria- Three weeks after.docxPuerto Rico has been devastated by hurricane Maria- Three weeks after.docx
Puerto Rico has been devastated by hurricane Maria- Three weeks after.docxsngyun4t79
 
public static void main(String-- args) { int i- int-- list - {0-1-0-4-.docx
public static void main(String-- args) { int i- int-- list - {0-1-0-4-.docxpublic static void main(String-- args) { int i- int-- list - {0-1-0-4-.docx
public static void main(String-- args) { int i- int-- list - {0-1-0-4-.docxsngyun4t79
 
Provide an example of an evervday material that is linearly elastic Pr.docx
Provide an example of an evervday material that is linearly elastic Pr.docxProvide an example of an evervday material that is linearly elastic Pr.docx
Provide an example of an evervday material that is linearly elastic Pr.docxsngyun4t79
 
Proteins in the blood plasma involved in hemostasis include Albumins A.docx
Proteins in the blood plasma involved in hemostasis include Albumins A.docxProteins in the blood plasma involved in hemostasis include Albumins A.docx
Proteins in the blood plasma involved in hemostasis include Albumins A.docxsngyun4t79
 
Proteins that lack a vacuolar localization signal will be secreted int.docx
Proteins that lack a vacuolar localization signal will be secreted int.docxProteins that lack a vacuolar localization signal will be secreted int.docx
Proteins that lack a vacuolar localization signal will be secreted int.docxsngyun4t79
 
Protective factors are anything that supports mental health and wellbe.docx
Protective factors are anything that supports mental health and wellbe.docxProtective factors are anything that supports mental health and wellbe.docx
Protective factors are anything that supports mental health and wellbe.docxsngyun4t79
 
Protein Structure - Briefiy explain the dynamics between amino ocid se.docx
Protein Structure - Briefiy explain the dynamics between amino ocid se.docxProtein Structure - Briefiy explain the dynamics between amino ocid se.docx
Protein Structure - Briefiy explain the dynamics between amino ocid se.docxsngyun4t79
 
project 1 - ARP table extraction- the first part of the program must h.docx
project 1 - ARP table extraction- the first part of the program must h.docxproject 1 - ARP table extraction- the first part of the program must h.docx
project 1 - ARP table extraction- the first part of the program must h.docxsngyun4t79
 
PROJECT MANAGEMENT ASSIGNMENT Tell me a project example from your expe.docx
PROJECT MANAGEMENT ASSIGNMENT Tell me a project example from your expe.docxPROJECT MANAGEMENT ASSIGNMENT Tell me a project example from your expe.docx
PROJECT MANAGEMENT ASSIGNMENT Tell me a project example from your expe.docxsngyun4t79
 
Positive directional linear selection on a trait always results in the.docx
Positive directional linear selection on a trait always results in the.docxPositive directional linear selection on a trait always results in the.docx
Positive directional linear selection on a trait always results in the.docxsngyun4t79
 

Plus de sngyun4t79 (20)

Presented below is information for Wildhorse Corp-- for the year 2025-.docx
Presented below is information for Wildhorse Corp-- for the year 2025-.docxPresented below is information for Wildhorse Corp-- for the year 2025-.docx
Presented below is information for Wildhorse Corp-- for the year 2025-.docx
 
Practice the following diagnostic statements using your Manual ICD-10.docx
Practice the following diagnostic statements using your Manual  ICD-10.docxPractice the following diagnostic statements using your Manual  ICD-10.docx
Practice the following diagnostic statements using your Manual ICD-10.docx
 
Potentials Question 15 Unanswered Hypokalemia (low extracellular K+ co.docx
Potentials Question 15 Unanswered Hypokalemia (low extracellular K+ co.docxPotentials Question 15 Unanswered Hypokalemia (low extracellular K+ co.docx
Potentials Question 15 Unanswered Hypokalemia (low extracellular K+ co.docx
 
Practice Management or Electronic Health Record- As a healthcare profe.docx
Practice Management or Electronic Health Record- As a healthcare profe.docxPractice Management or Electronic Health Record- As a healthcare profe.docx
Practice Management or Electronic Health Record- As a healthcare profe.docx
 
Prance- Inc-- earned pretax book net income of $941-000 in 2020- Pranc.docx
Prance- Inc-- earned pretax book net income of $941-000 in 2020- Pranc.docxPrance- Inc-- earned pretax book net income of $941-000 in 2020- Pranc.docx
Prance- Inc-- earned pretax book net income of $941-000 in 2020- Pranc.docx
 
ppl ppl ppl Match each ecosystem-biome with its traditional mone.docx
ppl ppl ppl       Match each ecosystem-biome with its traditional mone.docxppl ppl ppl       Match each ecosystem-biome with its traditional mone.docx
ppl ppl ppl Match each ecosystem-biome with its traditional mone.docx
 
Prepare Common-size financials for the Balance Sheet and Income Statem.docx
Prepare Common-size financials for the Balance Sheet and Income Statem.docxPrepare Common-size financials for the Balance Sheet and Income Statem.docx
Prepare Common-size financials for the Balance Sheet and Income Statem.docx
 
Q10- A person has inhaled carbon monoxide CO poisoning- CO has an ext.docx
Q10- A person has inhaled carbon monoxide  CO poisoning- CO has an ext.docxQ10- A person has inhaled carbon monoxide  CO poisoning- CO has an ext.docx
Q10- A person has inhaled carbon monoxide CO poisoning- CO has an ext.docx
 
Python Create 3 variables named- userName result userNum Prompt the u.docx
Python Create 3 variables named- userName  result userNum Prompt the u.docxPython Create 3 variables named- userName  result userNum Prompt the u.docx
Python Create 3 variables named- userName result userNum Prompt the u.docx
 
Python coding Question Assume the availability of a function is_prime-.docx
Python coding Question Assume the availability of a function is_prime-.docxPython coding Question Assume the availability of a function is_prime-.docx
Python coding Question Assume the availability of a function is_prime-.docx
 
Puerto Rico has been devastated by hurricane Maria- Three weeks after.docx
Puerto Rico has been devastated by hurricane Maria- Three weeks after.docxPuerto Rico has been devastated by hurricane Maria- Three weeks after.docx
Puerto Rico has been devastated by hurricane Maria- Three weeks after.docx
 
public static void main(String-- args) { int i- int-- list - {0-1-0-4-.docx
public static void main(String-- args) { int i- int-- list - {0-1-0-4-.docxpublic static void main(String-- args) { int i- int-- list - {0-1-0-4-.docx
public static void main(String-- args) { int i- int-- list - {0-1-0-4-.docx
 
Provide an example of an evervday material that is linearly elastic Pr.docx
Provide an example of an evervday material that is linearly elastic Pr.docxProvide an example of an evervday material that is linearly elastic Pr.docx
Provide an example of an evervday material that is linearly elastic Pr.docx
 
Proteins in the blood plasma involved in hemostasis include Albumins A.docx
Proteins in the blood plasma involved in hemostasis include Albumins A.docxProteins in the blood plasma involved in hemostasis include Albumins A.docx
Proteins in the blood plasma involved in hemostasis include Albumins A.docx
 
Proteins that lack a vacuolar localization signal will be secreted int.docx
Proteins that lack a vacuolar localization signal will be secreted int.docxProteins that lack a vacuolar localization signal will be secreted int.docx
Proteins that lack a vacuolar localization signal will be secreted int.docx
 
Protective factors are anything that supports mental health and wellbe.docx
Protective factors are anything that supports mental health and wellbe.docxProtective factors are anything that supports mental health and wellbe.docx
Protective factors are anything that supports mental health and wellbe.docx
 
Protein Structure - Briefiy explain the dynamics between amino ocid se.docx
Protein Structure - Briefiy explain the dynamics between amino ocid se.docxProtein Structure - Briefiy explain the dynamics between amino ocid se.docx
Protein Structure - Briefiy explain the dynamics between amino ocid se.docx
 
project 1 - ARP table extraction- the first part of the program must h.docx
project 1 - ARP table extraction- the first part of the program must h.docxproject 1 - ARP table extraction- the first part of the program must h.docx
project 1 - ARP table extraction- the first part of the program must h.docx
 
PROJECT MANAGEMENT ASSIGNMENT Tell me a project example from your expe.docx
PROJECT MANAGEMENT ASSIGNMENT Tell me a project example from your expe.docxPROJECT MANAGEMENT ASSIGNMENT Tell me a project example from your expe.docx
PROJECT MANAGEMENT ASSIGNMENT Tell me a project example from your expe.docx
 
Positive directional linear selection on a trait always results in the.docx
Positive directional linear selection on a trait always results in the.docxPositive directional linear selection on a trait always results in the.docx
Positive directional linear selection on a trait always results in the.docx
 

Dernier

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
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
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
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
 
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
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
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
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 

Dernier (20)

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
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"
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
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...
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
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
 
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
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
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
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 

Matlab code required for the following problem- Y - equation 1- when.docx

  • 1. Matlab code required for the following problem: Y = equation 1, when x is between 0 and a, Y = equation 2, when x is between a and b Using for/if/else functions Need total value of Y from x equals 0 to x = b, using x = [0:0.01:b]; Matlab code required for the following problem: Y = equation 1, when x is between 0 and a, Y = equation 2, when x is between a and b Using for/if/else functions Need total value of Y from x equals 0 to x = b, using x = [0:0.01:b]; Y = equation 1, when x is between 0 and a, Y = equation 2, when x is between a and b Using for/if/else functions Need total value of Y from x equals 0 to x = b, using x = [0:0.01:b]; Solution % matlab code a=input('eter a value') % enter value of a by user b=input('eter b value')
  • 2. y1=input(' enter first equation using a and b variables') y2=input(' enter second equation using a and b variables') for x=0:0.001:b for x=0:a y1; end for x=a:b y2 end y=y1+y2; end y