[Scilab-users] Plot a function that contains matrix operations
Svenja Lagershausen
lagershausen at prod.uni-hannover.de
Thu Nov 29 17:55:10 CET 2012
Dear users,
I would like to plot a function f(x) that contains matrix operations.
Correctly, it looks like this (obtained by Mathematica):
Do you know how to do this?
My code is:
//Löschen der Variablen
clear
//Bereinigen der Konsole
clc
// S. Lagershausen
// 29.11.2012
// System : M = 3, n = 3, Expo - vtlte Bz., mu1 = 0.7, mu2 = 0.5, mu3 = 0.9
// E[TBPS] = 2.59664365
// CV[TBPS] = 0.908682321
// Daten der Verteilung der Zeit zw. Bearbeitungsbeginnzeitpunkten an Station 1 :
initv = {1 0 0 0 0}
Smat = [-0.7 0.061984965 0 0.111572936 0.200831285;
0 -1.4 0.5 0 0;
0 0 -0.9 0 0;
0 0.5 0 -1.4 0;
0 0 0 0.5 -0.5]
onevec = {1 1 1 1 1}
S0vec = {0.325610814; 0.9; 0.9; 0.9; 0}
// Dichtefunktion :
scf(1); //create figure 1
clf(1); //clear figure 1
x=[1 : 0.2 : 20]
//x=2
////x= linspace(0,20,101);
//temp1=Smat*x
//f_x= sum(sum(Smat*x,"c"),"r")//
//test=Smat*(x);
f_x=initv*expm(Smat*x)*S0vec
//f_x=x
//
plot(x,f_x)
////xlabel('x'), ylabel('f(x)')
//title('Dichtefunktion von TBPS')
//Generating function of the PH renewal process
//P_Stern=exp((Smat + z*S0vec*initv)*x)
x is the variable. If I simply plug in a single value, it works (the result is a value)
However, if I I declare a range, it does not work anymore ("Inconsitent multiplication")
I suppose that Scilab understands the range of x as a vector such that the matrix operations cannot work that way.
Thank you very much for your help!
Best regards
Svenja Lagershausen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20121129/54eef138/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 1337 bytes
Desc: image001.png
URL: <https://lists.scilab.org/pipermail/users/attachments/20121129/54eef138/attachment.png>
More information about the users
mailing list