i want to plot some data by using Simulink Scope, here is my simplified Simulink model: enter image description here
and there are my code in the MATLAB Function Block:
1. function pCO2_a = Oxy(Qg)
2.
3. coder.extrinsic('testWQ');
4.
5. pCO2_a = zeros(41,1);
6. pCO2_a = testWQ();
7. end
what am i trying to call is another ode function:
1. function y = testWQ
2.
3. Qg = 3;
4. tspan = [0 5];
5. y0 = 0;
6. [t, Y] = ode45(@f,tspan,y0);
7. y = Y(:,1);
8.
9. function dydt = f(t,y)
10. dydt = Qg*t;
11. end
12.
13. end
And then i ran my Simulink model, in the Scope will of course show many horizontal lines instead of one line with time. I know the reason is because pCO2_a = testWQ()
will get double data, but is there any way i can still get the right diagram with this data in Scope?