Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

Latest threads

New Articles From Microcontroller Tips

Back
Top