Contrust a graph using Comsol Script.

In summary, to construct a simulink model of the extended system, the mass and stiffness values must be specified and the state-space model must be properly defined with input and output names before simulating it. It is also important to check for any syntax errors and refer to the documentation for the "ss" and "simulate" functions in MATLAB.
  • #1
Maxzchea
3
0

Homework Statement


Construct a simulink model of the extended system that fully represents it. Hint: If KST tends towards infinity the new model should be the same as the old provided the mass of the car body is unchanged.

M = 1200;
KST = 15000000;
MH = 60;
Kv = 3.2e+004


Homework Equations


If u need the diagram of the soultion kindly pm me with ur email. i email to u.



The Attempt at a Solution



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))


The problem is, i couldn;t get the graph of it. I tried using MATLAB and comsol script. Looks like there's an snytax error. Please help.
 
Physics news on Phys.org
  • #2


Hello,

Thank you for sharing your attempt at solving this problem. Your approach seems to be correct, however there may be a few errors in your code that are preventing you from getting the desired graph.

Firstly, in the line "Ss1 = ss(A, B, C, D);", you have not specified the input and output names for the state-space model. This could be causing an error when you try to simulate the model.

Secondly, in the line "simulate(Ss1,(U1, U2))", there seems to be an extra comma between U1 and U2. This could also be causing an error.

I would suggest going through your code again and checking for any syntax errors or missing information. You can also refer to the documentation for the "ss" and "simulate" functions in MATLAB to make sure you are using them correctly.

If you are still unable to get the desired graph, please provide more details about the specific error you are getting so that I can assist you further.

Best of luck with your simulation!
 
  • #3


I understand the importance of accurately representing a system in a graph. In order to construct a graph using Comsol Script, I would first ensure that the syntax error is resolved. This may involve checking for typos or consulting with a Comsol expert for assistance. Once the syntax error is resolved, I would proceed with the following steps:

1. Define the variables and parameters in the script, as shown in the given content (M, KST, MH, and Kv).
2. Use the defined variables to construct the state-space matrices A, B, C, and D.
3. Create input signals (U1 and U2) using the sig function, with appropriate values and time steps defined.
4. Simulate the system using the ss and simulate functions, passing in the state-space matrices and input signals.
5. Plot the output signals of interest (S1 and S2) against the time vector T using the plot function.

It is important to ensure that the input signals and time vector are compatible with the system parameters and time steps used in the simulation. If the graph does not accurately represent the system, I would review the steps and parameters used to identify any potential errors. Additionally, I may consult with an expert or refer to Comsol documentation for further guidance.
 

What is Comsol Script?

Comsol Script is a programming language used to construct and manipulate graphs within the Comsol Multiphysics software. It is based on the popular programming language MATLAB and allows for more precise and customizable graphing options.

How do I access Comsol Script?

Comsol Script can be accessed in the Comsol Multiphysics software by clicking on the "Script" button located in the ribbon at the top of the screen. This will open the Comsol Script window where you can write and execute your code.

What are the basic components of a graph constructed with Comsol Script?

The basic components of a graph constructed with Comsol Script include the axes, labels, data points, and a title. These can all be customized using Comsol Script commands to create a visually appealing and informative graph.

How do I add data to my graph using Comsol Script?

Data can be added to a graph using Comsol Script by first defining the data in an external file or by manually entering the data into the script. The data is then plotted using the appropriate Comsol Script commands, such as "plot" or "scatter".

Can I export my graph constructed with Comsol Script?

Yes, you can export your graph from Comsol Multiphysics by right-clicking on the graph and selecting "Export". This will allow you to save your graph in various image or document formats, such as JPG, PNG, or PDF.

Similar threads

  • General Engineering
Replies
2
Views
4K
Back
Top