plot two input of matlab function in simulink
Ältere Kommentare anzeigen
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 Kommentare
Sam Chak
am 26 Apr. 2022
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
am 26 Apr. 2022
Bearbeitet: Zainab Alnassar
am 27 Apr. 2022
Antworten (1)
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 Kommentare
Zainab Alnassar
am 26 Apr. 2022
@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...
Zainab Alnassar
am 28 Apr. 2022
Kategorien
Mehr zu Simulink finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

