Matlab code looking good? EE_Signals

Click For Summary

Discussion Overview

The discussion revolves around the correctness of MATLAB code used to graph two functions, x(t) = 9e^-2t for t>=0 and y(t) = 4e^(-9*pi*t). Participants are evaluating the approach taken in the code and its alignment with the problem statement, which involves graphing rather than convolution.

Discussion Character

  • Homework-related, Technical explanation, Debate/contested

Main Points Raised

  • One participant questions the use of convolution in the code, suggesting that the task is simply to graph the functions.
  • Another participant interprets the original poster's intent as possibly meaning to graph the convolution of the two functions.
  • A participant advises on adjusting the time vector to have smaller increments, suggesting that 0.01 is a better choice for the time step.
  • Another participant points out that the time values should be chosen based on the piecewise limits of the functions, implying that the current selection may be arbitrary.

Areas of Agreement / Disagreement

There is no consensus on whether the original MATLAB code is correct, as participants express differing views on the appropriateness of using convolution and the choice of time vector.

Contextual Notes

Participants have not resolved the assumptions regarding the correct approach to graphing the functions or the implications of using convolution in this context.

user101
Messages
205
Reaction score
0

Homework Statement



Graph of x(t) = 9e^-2t for t>=0 and y(t) = 4e^(-9*pi*t).

Is my MATLAB code correct? I did it by hand and I'm getting a different answer, so I don't know which one is the correct one... if my hand one is correctly done or if the MATLAB one is correct. I'm learning MATLAB on my own since our professor doesn't require it... he thinks that we'll rely on it too much, but here's my attempt @ it.

Homework Equations


The Attempt at a Solution



t = 1:7;
x = 9*exp(-2*t);
v = 4*exp(-9*pi*t);
a = conv(x,v);
plot(t,a(1:length(t)))
xlabel('values for t')
ylabel('x(t) * v(t) value')
 
Physics news on Phys.org
anyone?
 
Why are you using convolution when you are only asked to graph the functions?
 
he prob means graph the conv of the two functions.
 
t = 1:7;

Careful with your vector, you need to set the time instances. 0.01 is usually a good one

t = 1:0.01:7;
 
Your t value should be dependent on the function's piecewise linear limits. Did you pick a random t value?
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 9 ·
Replies
9
Views
5K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K