How to simulate a graph in Comsol Script?

  • Thread starter Thread starter Maxzchea
  • Start date Start date
  • Tags Tags
    Comsol Graph
Click For Summary
SUMMARY

This discussion focuses on simulating a graph using Comsol Script, specifically addressing issues encountered with the 'simulate' function. The user attempted to plot a graph using the command 'plot(x,y)' but faced syntax errors with 'simulate(Ss1,(U1,U2))'. The primary error reported was related to the 'sig' function, indicating a mismatch in dimensions between the time vector 'T' and the signal 'S1'. The user seeks guidance on correcting the 'sig' code to successfully generate the graph.

PREREQUISITES
  • Familiarity with Comsol Script syntax and functions
  • Understanding of state-space representation in control systems
  • Knowledge of signal generation using the 'sig' function
  • Basic concepts of matrix operations and dimensions in programming
NEXT STEPS
  • Review Comsol Script documentation on the 'sig' function for signal generation
  • Learn about state-space modeling and the 'ss' function in Comsol
  • Investigate error handling in Comsol Script to troubleshoot dimension issues
  • Explore plotting functions in Comsol for visualizing simulation results
USEFUL FOR

This discussion is beneficial for beginners in Comsol Script, engineers working with control systems, and anyone interested in simulating dynamic systems and generating corresponding graphs.

Maxzchea
Messages
2
Reaction score
0
I personally inform that i still beginner in Comsol Script. I wanted to learn about the comsol, how to simulate the graph. I tried plot(x,y). but i need to use this function simulate(Ss1,(U1,U2)). But at the end, it show Syntax error.
Heres the details of the code:

Ks = 600000; %spring stiffness of the car
M = 1200; %mass of the car
KST = 15000000; % New value for spring stiffness
MH = 48; % Constant value of the car.

A = [0 1 0 0 ; (-Ks+KST)/MH -Kv/MH -Ks/MH Kv/MH; 0 0 0 1; Ks/M Kv/M -Ks/M -Kv/M];
B= [0 0; KST/MH -1/MH; 0 0; 0 1/M];
C = [1 0 0 0; 0 0 1 0; 0 1 0 0; 0 0 0 1];
D = [0 0; 0 0; 0 0; 0 0];
Ss1 = ss(A, B, C, D);
T = [0:0.01:10]';
S1 = zeros(size(T));
S2 = 3000*ones(size(T));
U1 = sig(S1, T);
U2 = sig(S2, T);
simulate(Ss1,(U1, U2))

From the beginning, i type all the code together. can when it comes to U1=sig(S1,T);
it shows Error: SIG constructor: Length of t must equal number of rows in y
sig.sig 96 error('SIG constructor: Length of t must equal number of rows in y')

until the end i couldn't get the graph. How can i get the graph done? how to modify the sig code? i have no idea. i tried many times already. those who know. please take a look. Help me please. Thx in advance
 
Engineering news on Phys.org
Have you checked you've your pointwise and matrix acting operators (* & .*) in order & dimensions of different elements going about ok?
 

Similar threads

Replies
3
Views
4K
  • · Replies 9 ·
Replies
9
Views
4K
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
4
Views
9K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K