SlideShare una empresa de Scribd logo
1 de 2
change this code in a way to enter the x(t) and h(t) as shown in the following figure and calculate
and plot their convolution
I can just have the code, same structure way as the example please
Solution
clear all
close all
clc
stp=0.01;
t1=-5:stp:5;
x=zeros(1,length(t1));
ix1=find((t1>=--1)&(t1<1));
x(ix1)=1;
t2=0:stp:5
h=zeros(1,length(t2));
ix2=find((t2>=1)&(t2<4));
h(ix2)=1;
ix3=find((t2>=4)&(t2<5));
h(ix3)=2;
t=(min(t1)+min(t2)):stp:(max(t1)+max(t2));
y=stp*conv(x,h);
subplot(3,1,1)
plot(t1,x,'linewidth',2)
xlabel('t')
ylabel('x(t)')
grid on
subplot(3,1,2)
plot(t2,h,'linewidth',2)
xlabel('t')
ylabel('h(t)')
grid on
subplot(3,1,3)
plot(t,y,'linewidth',2)
xlabel('t')
ylabel('y(t)')
grid on

Más contenido relacionado

Más de rtodd544

Más de rtodd544 (6)

Can someone show me the steps and also two examples on how to find whi.docx
Can someone show me the steps and also two examples on how to find whi.docxCan someone show me the steps and also two examples on how to find whi.docx
Can someone show me the steps and also two examples on how to find whi.docx
 
Can someone suggest a hypothetical situation or scenario to exemplify.docx
Can someone suggest a hypothetical situation or scenario to exemplify.docxCan someone suggest a hypothetical situation or scenario to exemplify.docx
Can someone suggest a hypothetical situation or scenario to exemplify.docx
 
Can someone explain the more dilute the solution is (acid solution) th.docx
Can someone explain the more dilute the solution is (acid solution) th.docxCan someone explain the more dilute the solution is (acid solution) th.docx
Can someone explain the more dilute the solution is (acid solution) th.docx
 
can multilayers point to the same feature classSolutionNo- multiple la.docx
can multilayers point to the same feature classSolutionNo- multiple la.docxcan multilayers point to the same feature classSolutionNo- multiple la.docx
can multilayers point to the same feature classSolutionNo- multiple la.docx
 
Calculate the pH of the resulting solution if 22-0 mL of 0-220 M HCl(a.docx
Calculate the pH of the resulting solution if 22-0 mL of 0-220 M HCl(a.docxCalculate the pH of the resulting solution if 22-0 mL of 0-220 M HCl(a.docx
Calculate the pH of the resulting solution if 22-0 mL of 0-220 M HCl(a.docx
 
Calculate the radius of a palladium atom- given that Pd has an FCC cry.docx
Calculate the radius of a palladium atom- given that Pd has an FCC cry.docxCalculate the radius of a palladium atom- given that Pd has an FCC cry.docx
Calculate the radius of a palladium atom- given that Pd has an FCC cry.docx
 

Último

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Último (20)

Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
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
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 

change this code in a way to enter the x(t) and h(t) as shown in the f.docx

  • 1. change this code in a way to enter the x(t) and h(t) as shown in the following figure and calculate and plot their convolution I can just have the code, same structure way as the example please Solution clear all close all clc stp=0.01; t1=-5:stp:5; x=zeros(1,length(t1)); ix1=find((t1>=--1)&(t1<1)); x(ix1)=1; t2=0:stp:5 h=zeros(1,length(t2)); ix2=find((t2>=1)&(t2<4)); h(ix2)=1; ix3=find((t2>=4)&(t2<5)); h(ix3)=2; t=(min(t1)+min(t2)):stp:(max(t1)+max(t2)); y=stp*conv(x,h); subplot(3,1,1) plot(t1,x,'linewidth',2) xlabel('t') ylabel('x(t)') grid on subplot(3,1,2) plot(t2,h,'linewidth',2) xlabel('t') ylabel('h(t)') grid on subplot(3,1,3) plot(t,y,'linewidth',2)