
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
![Detail what the code does and how it works?
Plot the resulting graphs and modify them for
better visualization. (Matlab)
dx=0.001;
L-pi;
3 x=(1+dx: dx: 1) *L;
4
n=length (x);
5
6
N
10
11
12
13
14
15
16
nquart-floor (n/4);
17
18
19
% define the hat function;
8 f(nquart: 2* nquart) = 4* (1:nquart+1)/n;
9 f(2*nquart+1:3*nquart)=1-4*[1:500]/n;
plot (x, f, 'r', 'LineWidth', 2);
hold on;
f=0*x;
A0-sum (f. * ones (size (x)))*dx;
fFS = A0/2;
for k=1:10
Ak-sum (f. * cos(pi*k*x/L)) *dx;
Bk sum(f.* sin (pi*k*x/L))*dx;
fFS=fFS+Ak*cos(pi*k*x/L) + Bk* sin(pi*k*x/L);
plot (x, fFS);
pause (1);
drawnow;
end](https://content.bartleby.com/qna-images/question/4b4d48fa-46ea-44c5-88e2-3c2d922f7aa0/89087312-6d73-4776-8e67-bf463274e571/sejs1pl_thumbnail.jpeg)
Transcribed Image Text:Detail what the code does and how it works?
Plot the resulting graphs and modify them for
better visualization. (Matlab)
dx=0.001;
L-pi;
3 x=(1+dx: dx: 1) *L;
4
n=length (x);
5
6
N
10
11
12
13
14
15
16
nquart-floor (n/4);
17
18
19
% define the hat function;
8 f(nquart: 2* nquart) = 4* (1:nquart+1)/n;
9 f(2*nquart+1:3*nquart)=1-4*[1:500]/n;
plot (x, f, 'r', 'LineWidth', 2);
hold on;
f=0*x;
A0-sum (f. * ones (size (x)))*dx;
fFS = A0/2;
for k=1:10
Ak-sum (f. * cos(pi*k*x/L)) *dx;
Bk sum(f.* sin (pi*k*x/L))*dx;
fFS=fFS+Ak*cos(pi*k*x/L) + Bk* sin(pi*k*x/L);
plot (x, fFS);
pause (1);
drawnow;
end
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 5 steps with 4 images

Knowledge Booster
Similar questions
- Q3: Write a matlab program call matq3.m that returns the plot of the 2- D space defined by the following equation: (-xsin(x) cos (x) - 2π ≤ x < 0 x ≥ 2π Label the x-axis and y-axis and z-axis and title to the curve. y =arrow_forwardNeed help in Matlab. How do I modify this program to produce eye shapes like the pink picture using scaling, rotating and translating? Thank you! figure(1) x(1:2,1)=[1;0]; plot(x(1), x(2),'*'); grid on; hold on; axis([-15 15 -15 15]); k=1; Inc=1; for j=1:Inc:360; x(1:2,k+1)=[cosd(Inc) -sind(Inc);sind(Inc) cosd(Inc)]*x(1:2,k); plot(x(1,k+1), x(2,k+1),'^'); k=k+1; %for j=1:Inc:360; %x(1:2,k+1)=[cosd(Inc) -sind(Inc);sind(Inc) cosd(Inc)]*x(1:2,k); %plot(x(1,k+1), x(2,k+1),'^'); %k=k+1; %pause(); end for k=1:Inc:360; y1(1:2,k)=[1.5 0;0 3]*x(1:2,k); plot(y1(1,k),y1(2,k),'^') %for k=1:Inc:360; %y1(1:2,k)=[1.5 0;0 3]*x(1:2,k); %plot(y1(1,k),y1(2,k),'^') %pause(0.1); end for k=1:Inc:360; y2(1:2,k)=[3 0;0 1.5]*x(1:2,k)+[7;5]; plot(y2(1,k),y2(2,k),'^') %for k=1:Inc:360; %y2(1:2,k)=[3 0;0 1.5]*x(1:2,k)+[7;5]; %plot(y2(1,k),y2(2,k),'^') %pause(0.1); end for k=1:Inc:360; y3(1:2,k)=[3 0;0 1.5]*x(1:2,k)+[-7;5]; plot(y3(1,k),y3(2,k),'^') %for k=1:Inc:360; %y3(1:2,k)=[3 0;0 1.5]*x(1:2,k)+[-7;5];…arrow_forwardPLEASE USE C PROGRAMMING TO CODE THIS PROBLEM. EXPLAIN the logic with us of a diagram if possible, or clear enough that i can write this code if I was to ever come across a problem like it again Description Given a board with N rows and M columns, the rows are numbered from 1 to N from top to bottom, and the columns are numbered from 1 to M from left to right. Each element has one diagonal wall which either runs from top-left corner to bottom-right corner, or runs from top-right corner to bottom-left corner. Now given Q queries, you have to output which column the ball will fall out at the bottom row if you put it on top of the board at specific column. (The ball will naturally fall down due to gravity.) The following figure is a sample. If you drop the ball at column 2, the ball will fall out at the left side. If you drop the ball at column 5, the ball will be stuck in the board. If you drop the ball at column 3, the ball will eventually fall out at column 2. Input First line…arrow_forward
- Give an example of a while loop, then provide the equivalent do-while loop and for loop. Then give a different example of a do-while loop, along with the equivalent while loop and for loop. Finally, give an example of a for loop, along with the equivalent while loop and do-while loop. Use your examples to illustrate the advantages and disadvantages of each looping structure, and describe those advantages and disadvantages.arrow_forward6. X is (a,b,c,d), Y is {1,2,3,4). {(a,1), (b,2), (c,2), (d,4)) is a function from X to Y.arrow_forwardurgent plzzz..asaparrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY