Help using a cost function to compute fitness of strings in a matrix using Eulers code to calculate position vs time.

3 views (last 30 days)
This is the step that I am on in my program. I am new to this and am not understanding it.
Compute the fitness of each genetic string. That is,genetic strings are to be ranked according to the cost function,𝜋.
Use your Euler code to calculate the position versus time behavior of the each SMD system given its parameters. During this calculation, record the position of the mass at the desired times, which can then beused in the calculation of π for that string.
𝜋=(𝑥𝑡=2−8.67)2+(𝑥𝑡=4−11.67)2+(𝑥𝑡=6−9.67)2+(𝑥𝑡=8−9.52)2+(𝑥𝑡=10−9.90)2. (The t=_ should be subscript)
I am completely lost. I need to pass in the x values from time=2, 4, 6, 8 and 10 seconds. The x is from a matrix of (60,5) with (x, m, k, and c) randomly generated. The following is just one thing that I tried of many that isn't working. Any help would be great!
Fit=(x(t(201)) -8.67)^2+(x(t(401))-11.67)^2+(x(t(401))-9.67)^2+(x(t(601))-9.52)^2+(x(t(1001))-9.90)^2;
Population(String,5)=Fit;
Any help would be great!

Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!