plot two input of matlab function in simulink

I have two waves as input of matlab function and I want to plot one of them X axis and other one on Y axis , what is the coding i should use ?
I have tried
function out=fcn(acc,slip)
plot(slip,acc)
without any result

댓글 수: 2

Sam Chak
Sam Chak 2022년 4월 26일
Please sketch the desired wave strictly on the X-axis and the other one strictly on the Y-axis.
This helps to visualize what you want to achieve in the final outcome.
Zainab Alnassar
Zainab Alnassar 2022년 4월 26일
편집: Zainab Alnassar 2022년 4월 27일

댓글을 달려면 로그인하십시오.

답변 (1개)

Sam Chak
Sam Chak 2022년 4월 26일
편집: Sam Chak 2022년 4월 27일

0 개 추천

You can stick with your custom function for plotting the phase portrait:
function out = fcn(x, y)
plot(x, y)
grid on
xlabel('slip')
ylabel('acc')
end
On the Command Window:
% Either Data is loaded to the Workspace, or generated by some means
t = linspace(0, 10, 1001);
slip = exp(-t).*cos(10*t);
acc = - exp(-t).*(cos(10*t) + 10*sin(10*t));
% Call the function to plot the phase portrait (vector lengths of slip & acc must match!)
fcn(slip, acc)

댓글 수: 3

no actually i dont need to plot(y,x) and there is no formula between two input
Sam Chak
Sam Chak 2022년 4월 27일
편집: Sam Chak 2022년 4월 27일
@Zainab Alnassar, thanks for being clear on what you really want. A picture is worth a thousand words.
I have edited my Answer to show you how to do it. Hope you find the Answer helpful...
thank you for your help @Sam Chak .
actually these acc and slip are input in simulink as in the picture , they are not equations. I will appreciate your help with that too whereas I need to plot these inputs along with some graphs to compare between them.
I can use XYgraph block but the purpose in comarison .

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Simulink에 대해 자세히 알아보기

질문:

2022년 4월 26일

댓글:

2022년 4월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by