Difference between MacOS and Windows

Hello
I am rather new to Matlab and I am working on a simple project on MatLab and Simulink but I have an issue with it.
When I am running my script and simulink model on Matlab 2017 for Windows (at school), the plot that I obtain are the one that I expect to have. But the minute I run the same script and simulink model on MatLab 2022 for MacOS (personnal computer) the plot that I get is not what I expect it to be, furthermore it is not the same as what I get under MatLab 2017 for Windows which is very odd. For information, the script uses very simple mathematical object such as matrix and sqrt
Does someone know where does this difference could come from ? I'm kind of going crazy because of it.
Thank you in advance for your responses !

댓글 수: 7

Luca Ferro
Luca Ferro 2023년 3월 1일
could you share the script?
Guillemette
Guillemette 2023년 3월 1일
Sure
Guillemette
Guillemette 2023년 3월 1일
The simulink model : gain 3 is B1*u, gain 2 is A1*u and gain 1 is C1*u, the sine wave is u(t)=10*sin(wt)
Bruno Luong
Bruno Luong 2023년 3월 1일
편집: Bruno Luong 2023년 3월 1일
Please share the script by typing the code here (capsulated using the [>] icon) or attach the mfile with paperclip icon, NOT the screenshot that is not useful.
Then show the results between MATLAB versions and computers.
Guillemette
Guillemette 2023년 3월 1일
On the left there is the scope view that I get when I'm runningg the script on MacOS and on the right there is the scope view that I get when I'm running the script on Windows (this one is the one I expect)
@Bruno Luong ok I am going to share the code in another way, sorry about the screenshot
%parameters
M1=25;
M2=250;
K1=210000;
K2=29500;
b1=13100;
b2=1850;
%Part 1
A1 = [-b2/M2 1/M2; -K2 0];
B1 = [b2/M2; K2];
C1 = [1 0];
D1 = 0;
%Part 2
A2 = [-b2/M2 1/M2 b2/M2 0; -K2 0 K2 0; b2/M1 -1/M1 -(b1+b2)/M2 1/M1; 0 0 -K1 0];
B2 = [0 ;0 ;b1/M1 ;K1];
C2 = [1 0 0 0];
D2 = 0;
%Simulation for different w
w=2*pi;
w1=5*sqrt(K1/M1);
w2=w1/5;
w3=w2/2;
w4=sqrt(K2/M2);
w5=w4*0.1;
Luca Ferro
Luca Ferro 2023년 3월 1일
편집: Luca Ferro 2023년 3월 1일
just a guess but:
  • check the solver type/step (mac seems variable, windows fixed)
  • try to compare the graphs as the same order of dimension on x axis (mac is 0-1-2-3, windows 0.001, 0.002, ..)
  • check the simulation time (mac is 10s, windows is 0.1

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

답변 (0개)

카테고리

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

제품

릴리스

R2022b

질문:

2023년 3월 1일

편집:

2023년 3월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by