Guy
Guy

Reputation: 7

How to find the minimum value of signal?

I have the message signal of s(t) and I know the code of finding the minimum of signal min(s).

If t > 2, s(t) will be equal to 0.

How can I find the minimum value of s(t) within 2 second?

I need to plot conventional AM signal, I have message signal s(t) and module signal, and the s(t) is equal to 0 when t > 2, now I need to calculate the minimum value of s(t) for calculating the Ac value.

Upvotes: 0

Views: 234

Answers (1)

heldm
heldm

Reputation: 68

If I'm reading this right, you want to restrict the space in which you are searching for the minimum. You can use logical indexing to do this.

timevector = 1:10000; %in ms
signal = randi(1000, 10000, 1);
signal(2000:10000) = 0;

log_signal = timevector < 2000;
constrained_signal = signal(log_signal);
minimum = min(constrained_signal);

Upvotes: 3

Related Questions