MATLAB help needed

Status
Not open for further replies.

osman82

New Member
need to generate the following signal in matlab...anybody can help??

x(t)=exp(-0.1t) Sin0.6t

for t= 0 to 40ms in steps of 0.1 sec.

thanks people
 
t = 0:.0001:40;
x = e.^(-.1*t) * sin(0.6*t)

try that for starters. the equation may need some work. i also assume you meant 0.1ms not 0.1s.
 
Last edited:
Probably a way to vectorize without a loop, but this would do it:

create a function:
Code:
function output = sig_gen(input)

for x = 1:length(input)
    output(:,x) = exp(-0.1*(input(:,x))) *  sin(0.6 * input(:,x));
end

Then call:

Code:
signal = sig_gen(0:0.1:40);
then you could plot:

Code:
plot(0:0.1:40,signal);
or in one step:

Code:
plot(0:0.1:40, sig_gen(0:0.1:40));
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…