hi I have this code I run it on matlab command its ok working I try to make it as a fitness function for GA but its not working at all
%function MSE= GA(g_pulse_max,x1train_max)
Xrange=-3:0.1:2.4;
mu=-0.5;
sigma= 0.17;
g_pulse= 1/sqrt(2*pi*sigma^2) * exp( - ( Xrange - mu).^2/(2*sigma^2));
g_pulse_max=g_pulse/max(g_pulse);
plot(g_pulse_max);
hold on
x1train_max = x1train/max(x1train);
plot(x1train_max);
hold on
can anybody help me to solve it?

 採用された回答

Walter Roberson
Walter Roberson 2015 年 11 月 6 日

0 投票

What error shows up?
You would certainly not want to be plotting in a fitness function.
Your commented out header for the code suggests that you expect two variables to be passed in. The fitness function for ga() will pass in only a single variable which will be a row vector whose length is nvar the number of variables you declared were present.
Your commented out header for the code suggests that you expect to calculate a variable named MSE and return it. Your code does not calculate MSE.

その他の回答 (1 件)

Asmaa Mohammed
Asmaa Mohammed 2015 年 11 月 6 日

0 投票

thank you so much for reply.. what I want from the code is to enter normal gaussian pulse with normalized data sequence I want for the GA to shape the data sequence like gaussian pulse in other words I want to remove the noise or the lower impulse response from the data sequence how can write the fitness function to achieve that? after that I get the output from the GA and compute the mean square error. I will be so thankful if you help me to achieve that.

1 件のコメント

Asmaa Mohammed
Asmaa Mohammed 2015 年 11 月 6 日
編集済み: Asmaa Mohammed 2015 年 11 月 6 日
like this photo.. the green curve represent the gaussian pulse the red curve is for distorted signal.. I want to redistribute the impulse response for the red curve to be fitted inside the gussian pulse by using GA

サインインしてコメントする。

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by