Plotting double data in Simulink Scope

조회 수: 2 (최근 30일)
Wenqing Qiu
Wenqing Qiu 2020년 2월 20일
답변: Samatha Aleti 2020년 2월 24일
i want to plot some data by using Simulink Scope, here is my simplified Simulink model:
and there are my code in the MATLAB Function Block:
function pCO2_a = Oxy(Qg)
coder.extrinsic('testWQ');
pCO2_a = zeros(41,1);
pCO2_a = testWQ();
end
what am i trying to call is another ode function:
function y = testWQ
Qg = 3;
tspan = [0 5];
y0 = 0;
[t, Y] = ode45(@f,tspan,y0);
y = Y(:,1);
function dydt = f(t,y)
dydt = Qg*t;
end
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?

답변 (1개)

Samatha Aleti
Samatha Aleti 2020년 2월 24일
Hi,
You should be able to view many horizontal lines in the SIMULINK scope, provided your output vector “y” holds elements of different values. Check whether the elements of “y” are of different values or not.

카테고리

Help CenterFile Exchange에서 Event Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by