Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to simulate a graph in Comsol Script?

  1. Dec 25, 2008 #1
    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. plz take a look. Help me plz. Thx in advance
     
  2. jcsd
  3. Jan 2, 2009 #2

    PerennialII

    User Avatar
    Science Advisor
    Gold Member

    Have you checked you've your pointwise and matrix acting operators (* & .*) in order & dimensions of different elements going about ok?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: How to simulate a graph in Comsol Script?
  1. COMSOL Script question (Replies: 4)

Loading...