{"id":5488,"date":"2022-03-23T18:01:27","date_gmt":"2022-03-23T09:01:27","guid":{"rendered":"https:\/\/blogs.mathworks.com\/japan-community\/?p=5488"},"modified":"2023-03-24T14:26:26","modified_gmt":"2023-03-24T05:26:26","slug":"matlab-simulink-parsim","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/japan-community\/2022\/03\/23\/matlab-simulink-parsim\/","title":{"rendered":"MATLAB + Simulink \u3067\u8907\u6570\u306e\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u4e00\u6c17\u306b\u5b9f\u884c\uff01"},"content":{"rendered":"<p>\u7686\u3055\u3093\u3053\u3093\u306b\u3061\u306f\u3002\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u9060\u85e4\u3067\u3059\u3002<br \/>\n\u3053\u306e\u30d6\u30ed\u30b0\u3067\u306f\u3001\u300cSimulink \u3068 MATLAB \u3092\u3064\u306a\u3050\u300d\u3092\u30b3\u30f3\u30bb\u30d7\u30c8\u3068\u3057\u3066\u3001\u4e3b\u306b\u6280\u8853\u7684\u306a\u5185\u5bb9\u306b\u3064\u3044\u3066\u66f8\u3044\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u3055\u3066\u3001\u5148\u65e5\u3064\u3044\u306b R2022a \u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u307e\u3057\u305f\u306d\uff01\u6ce8\u76ee\u306e\u65b0\u6a5f\u80fd\u304c\u76db\u308a\u6ca2\u5c71\u3067\u79c1\u3082\u697d\u3057\u304f\u30ea\u30ea\u30fc\u30b9\u30ce\u30fc\u30c8\u3092\u8aad\u3093\u3067\u3044\u307e\u3059\u3002\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u65e9\u901f\u305d\u308c\u3089\u306e\u6a5f\u80fd\u306e\u7d39\u4ecb\uff01\u2026\u2026\u3068\u884c\u304d\u305f\u3044\u3068\u3053\u308d\u306a\u306e\u3067\u3059\u304c\u3001\u4f8b\u306e\u3054\u3068\u304f\u30ea\u30ea\u30fc\u30b9\u76f4\u5f8c\u3068\u3044\u3046\u3053\u3068\u3082\u3042\u3063\u3066\u81ea\u5206\u3067\u3082\u8272\u3005\u3068\u6a5f\u80fd\u3092\u8abf\u67fb\u4e2d\u306e\u305f\u3081\u3001\u65b0\u6a5f\u80fd\u306e\u7d39\u4ecb\u306f\u307e\u305f\u5225\u306e\u6a5f\u4f1a\u306b\u3067\u304d\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f Simulink \u3068 MATLAB \u3092\u7e4b\u3050\u5927\u304d\u306a\u7406\u7531\u306e\u4e00\u3064\u3067\u3042\u308b\u300c<strong>\u8907\u6570\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u5b9f\u884c<\/strong>\u300d\u306b\u3064\u3044\u3066\u89e3\u8aac\u8a18\u4e8b\u3092\u66f8\u3044\u3066\u3044\u3053\u3046\u304b\u3068\u601d\u3044\u307e\u3059\u3002\u3044\u308d\u3093\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u30b9\u30a4\u30fc\u30d7\u3055\u305b\u3066\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u884c\u3044\u7d50\u679c\u3092\u6bd4\u8f03\u3057\u305f\u3044\u3001\u7570\u306a\u308b\u5165\u529b\u30c7\u30fc\u30bf\u3067\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u884c\u3044\u30e2\u30c7\u30eb\u306e\u691c\u8a3c\u3092\u3057\u305f\u3044\u306a\u3069\u306a\u3069\u3001\u8907\u6570\u306e\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u4e00\u5ea6\u306b\u5b9f\u884c\u3057\u305f\u3044\u5834\u9762\u306f\u5c11\u306a\u304f\u3042\u308a\u307e\u305b\u3093\u3002\u3082\u3061\u308d\u3093\u624b\u52d5\u3067\u30e2\u30c7\u30eb\u3092\u7de8\u96c6\u3057\u3066\u9010\u6b21\u7684\u306b\u5b9f\u884c\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u304c\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u81ea\u52d5\u5316\u3059\u308b\u3068\u975e\u5e38\u306b\u52b9\u7387\u7684\u306b\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u8907\u6570\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u7528\u306e\u95a2\u6570\u306f\u5c11\u3005\u4f7f\u3044\u65b9\u306b\u7656\u304c\u3042\u308a\u3001MATLAB \u306b\u6163\u308c\u3066\u3044\u306a\u3044\u4eba\u306b\u3068\u3063\u3066\u306f\u5c11\u3057\u624b\u3092\u51fa\u3057\u3065\u3089\u3044\u90e8\u5206\u3082\u3042\u308a\u307e\u3059\u3002\u305d\u3053\u3067\u3001\u3053\u306e\u8a18\u4e8b\u3067\u306f\u300c\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30b9\u30a4\u30fc\u30d7\u300d\u3068\u300c\u7570\u306a\u308b\u5165\u529b\u30c7\u30fc\u30bf\u306e\u4f7f\u7528\u300d\u306e\uff12\u3064\u306b\u7126\u70b9\u3092\u5f53\u3066\u3001\u8907\u6570\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u5b9f\u884c\u306e\u65b9\u6cd5\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u3053\u3093\u306a\u65b9\u306b\u30aa\u30b9\u30b9\u30e1\uff01<\/p>\n<ul>\n<li>\u6700\u9069\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u8abf\u67fb\u306e\u305f\u3081\u306b\u3001<span style=\"color: #ff0000\">\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u30b9\u30a4\u30fc\u30d7\u3057\u306a\u304c\u3089\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u305f\u3044<\/span><\/li>\n<li><span style=\"color: #ff0000\">\u8272\u3005\u306a\u5165\u529b\u30c7\u30fc\u30bf\u3092\u4f7f\u3063\u3066\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u305f\u3044<\/span><\/li>\n<li>\u8907\u6570\u30b3\u30a2\u3092\u7528\u3044\u3066<span style=\"color: #ff0000\">\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u4e26\u5217\u5b9f\u884c\u3057\u305f\u3044<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1000\" height=\"750\" class=\"alignnone size-full wp-image-5491\" src=\"https:\/\/blogs.mathworks.com\/japan-community\/files\/2022\/03\/manager.png\" alt=\"\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u203b\u8907\u6570\u30b3\u30a2\u3092\u4f7f\u3063\u3066\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u4e26\u5217\u5b9f\u884c\u3059\u308b\u5834\u5408\u306f Parallel Computing Toolbox \u304c\u5fc5\u8981\u3067\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3067\u7d39\u4ecb\u3057\u3066\u3044\u308b\u6a5f\u80fd\u306f Parallel Computing Toolbox \u306a\u3057\u3067\u3082\u4f7f\u7528\u3067\u304d\u307e\u3059\u304c\u3001\u305d\u306e\u5834\u5408\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306f\u9010\u6b21\u5b9f\u884c\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h1><span style=\"color: #ff6600\">1. parsim \u95a2\u6570\u3092\u7528\u3044\u305f\u8907\u6570\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3<\/span><\/h1>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u8907\u6570\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3068\u3044\u3046\u3068 for \u30eb\u30fc\u30d7+ <a href=\"https:\/\/jp.mathworks.com\/help\/simulink\/slref\/sim.html\">sim<\/a> \u95a2\u6570\u3092\u601d\u3044\u6d6e\u304b\u3079\u308b\u65b9\u3082\u3044\u3089\u3063\u3057\u3083\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u5b9f\u306f MATLAB R2017a \u304b\u3089\u8907\u6570\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u5b9f\u884c\u7528\u306e\u95a2\u6570\u3067\u3042\u308b <a href=\"https:\/\/jp.mathworks.com\/help\/simulink\/slref\/parsim.html?s_tid=doc_ta\">parsim<\/a> \u304c\u5c0e\u5165\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u3088\u308a\u52b9\u7387\u7684\u306b\u8907\u6570\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u306f parsim \u95a2\u6570\u306e\u4f7f\u3044\u65b9\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u3001\uff11\u56de\u306e\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u884c\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002parsim \u95a2\u6570\u306f sim \u95a2\u6570\u3068\u306f\u9055\u3044\u3001\u5358\u7d14\u306b\u30e2\u30c7\u30eb\u540d\u3092\u6307\u5b9a\u3057\u3066\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u884c\u3046\u3068\u3044\u3046\u3053\u3068\u306f\u3067\u304d\u305a\u3001SimulationInput \u3068\u3044\u3046\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u6e21\u3057\u3066\u3042\u3052\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002SimulationInput \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u3001<a href=\"https:\/\/jp.mathworks.com\/help\/simulink\/slref\/simulink.simulationinput-class.html\">Simulink.SimulationInput<\/a> \u95a2\u6570\u306b\u30e2\u30c7\u30eb\u540d\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u4f5c\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><code>&gt;&gt; in = Simulink.SimulationInput(<span style=\"color: #ff00ff\">\"vdp\"<\/span>);<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>\u4f5c\u3063\u305f SimulationInput \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092 parsim \u95a2\u6570\u306b\u6e21\u305b\u3070\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><code>&gt;&gt; out = parsim(in)<\/code><br \/>\nout =<br \/>\n<span style=\"color: #0000ff\">Simulink.SimulationOutput<\/span>:<br \/>\nSimulationMetadata: [1&#215;1 Simulink.SimulationMetadata]<br \/>\nErrorMessage: [0x0 char]<\/p>\n<p>&nbsp;<\/p>\n<p>\u3053\u308c\u3060\u3051\u3060\u3068\u9762\u5012\u304f\u3055\u3044\u3060\u3051\u306e sim \u95a2\u6570\u306b\u898b\u3048\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001parsim \u95a2\u6570\u306e\u6700\u5927\u306e\u7279\u5fb4\u306f\u3001SimulinkInput \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u914d\u5217\u3092\u6e21\u3057\u3066\u3042\u3052\u308b\u3053\u3068\u3067\u3001\u305d\u306e\u914d\u5217\u5206\u306e\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u884c\u3063\u3066\u304f\u308c\u308b\u70b9\u3067\u3059\u3002<\/p>\n<pre><code><span style=\"color: #0000ff\">for<\/span> i = 10:-1:1\r\n  in(i) = Simulink.SimulationInput(\"vdp\");\r\n<span style=\"color: #0000ff\">end<\/span><\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>for \u30eb\u30fc\u30d7\u3067 SimulationInput \u914d\u5217\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\uff0810 \u304b\u3089 1 \u306b\u6e1b\u3089\u3059\u65b9\u5411\u306b for \u30eb\u30fc\u30d7\u3057\u3066\u3044\u308b\u306e\u306f\u3001\u6700\u521d\u306b 10 \u500b\u5206\u306e\u30e1\u30e2\u30ea\u3092\u78ba\u4fdd\u3059\u308b\u305f\u3081\u3067\u3059\u3002\u7279\u306b\u30e1\u30e2\u30ea\u3092\u6c17\u306b\u3057\u306a\u3044\u65b9\u306f 1 \u304b\u3089 10 \u306e\u30eb\u30fc\u30d7\u3067\u3082\u554f\u984c\u306a\u304f\u52d5\u4f5c\u3057\u307e\u3059\uff09\u3053\u306e\u3088\u3046\u306b\u3057\u3066\u4f5c\u3063\u305f\u914d\u5217\u3092 parsim \u306b\u6e21\u305b\u3070\u3001<\/p>\n<p><code>&gt;&gt; out = parsim(in)<\/code><br \/>\nout =<br \/>\n1&#215;10 Simulink.SimulationOutput \u914d\u5217<\/p>\n<p>&nbsp;<\/p>\n<p>10 \u56de\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u304c\u884c\u308f\u308c\u307e\u3057\u305f\u3002\u305f\u3060\u3001\u3082\u3061\u308d\u3093\u4f55\u3082\u8a2d\u5b9a\u3057\u3066\u3044\u306a\u3044\u306e\u3067 10 \u56de\u3068\u3082\u540c\u3058\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u304c\u884c\u308f\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u914d\u5217\u306e\u5404\u8981\u7d20\u306e\u8a2d\u5b9a\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u3067\u3001\u7570\u306a\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u3084\u5165\u529b\u30c7\u30fc\u30bf\u3092\u4f7f\u3063\u305f\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u4e00\u6c17\u306b\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u306e\u3067\u3001\u65e9\u901f\u3084\u308a\u65b9\u3092\u78ba\u8a8d\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>&nbsp;<\/p>\n<h1><span style=\"color: #ff6600\">2. \u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30b9\u30a4\u30fc\u30d7<\/span><\/h1>\n<p>SimulationInput \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e <a href=\"https:\/\/jp.mathworks.com\/help\/simulink\/slref\/setvariable.html\">setVariable<\/a>\u00a0\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306b\u4f7f\u7528\u3055\u308c\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><code>&gt;&gt; in = in.setVariable(<span style=\"color: #ff00ff\">\"K\"<\/span>,10);<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>\u30e2\u30c7\u30eb\u5185\u3067\u4f7f\u7528\u3055\u308c\u3066\u3044\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u540d\u3068\u5024\u3092\u30bb\u30c3\u30c8\u3067\u6307\u5b9a\u3057\u307e\u3059\u3002\u6ce8\u610f\u70b9\u3068\u3057\u3066\u3001setVariable \u95a2\u6570\u306f\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5024\u3092\u5909\u66f4\u3057\u305f SimulationInput \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u51fa\u529b\u5f15\u6570\u3068\u3057\u3066\u8fd4\u3059\u306e\u3067\u3001\u540c\u3058\u540d\u524d\u306e\u5909\u6570\uff08\u4eca\u56de\u306f in\uff09\u306b\u5165\u308c\u76f4\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3092\u5229\u7528\u3057\u3066\u3001SimulationInput \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u914d\u5217\u3092\u4f5c\u6210\u3057\u3001\u5404\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u305d\u308c\u305e\u308c\u7570\u306a\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6307\u5b9a\u3057\u3066\u3042\u3052\u308b\u3053\u3068\u3067\u3001\u69d8\u3005\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u7528\u3044\u305f\u4e26\u5217\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3068\u3057\u3066\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u8d85\u7c21\u5358\u306a\u30e2\u30c7\u30eb\u3067\u6319\u52d5\u3092\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1317\" height=\"741\" class=\"alignnone size-full wp-image-5533\" src=\"https:\/\/blogs.mathworks.com\/japan-community\/files\/2022\/03\/myModel.png\" alt=\"\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u7d50\u679c\u3092\u78ba\u8a8d\u3057\u3084\u3059\u3044\u3088\u3046\u306b\u3001\u30c7\u30fc\u30bf\u306e\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u8a2d\u5b9a\u3082\u5909\u66f4\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1330\" height=\"860\" class=\"alignnone size-full wp-image-5545\" src=\"https:\/\/blogs.mathworks.com\/japan-community\/files\/2022\/03\/config.png\" alt=\"\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u3053\u306e\u30e2\u30c7\u30eb\u306e K \u3092 1 \u304b\u3089 10 \u307e\u3067\u30b9\u30a4\u30fc\u30d7\u3055\u305b\u3066 parsim \u95a2\u6570\u3067\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u307e\u305a\u306f\u30b9\u30a4\u30fc\u30d7\u3055\u305b\u308b\u5024\u3092\u914d\u5217\u3067\u4f5c\u6210\u3057\u307e\u3059\u3002<br \/>\n<code>Ksweep = 1:10;<\/code><br \/>\n\u6b21\u306b SimulationInput \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u914d\u5217\u3092\u4f5c\u6210\u3057\u306a\u304c\u3089\u3001\u5404\u8981\u7d20\u306b Ksweep \u306e\u5bfe\u5fdc\u3059\u308b\u5024\u3092 setVariable \u3067 \u30d1\u30e9\u30e1\u30fc\u30bf K \u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre><code><span style=\"color: #0000ff\">for<\/span> i = 10:-1:1\r\n  in(i) = Simulink.SimulationInput(<span style=\"color: #ff00ff\">\"myModel\"<\/span>);\r\n  in(i) = in(i).setVariable(<span style=\"color: #ff00ff\">\"K\"<span style=\"color: #000000\">,Ksweep(i)<\/span><\/span>);\r\n<span style=\"color: #0000ff\">end<\/span>\r\nout = parsim(in)<\/code><\/pre>\n<p>for \u30eb\u30fc\u30d7\u3092 10 \u304b\u3089 1 \u306b\u6e1b\u3089\u3059\u65b9\u5411\u306b\u3057\u3066\u3044\u308b\u306e\u306f\u3001\u5148\u306b 10 \u500b\u5206\u306e\u30e1\u30e2\u30ea\u30fc\u3092\u78ba\u4fdd\u3059\u308b\u305f\u3081\u3067\u3059\u3002\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u7d50\u679c\u3092\u78ba\u8a8d\u3057\u3066\u307f\u308b\u3068\u2026\u2026<\/p>\n<p><code>&gt;&gt; out(1).yout(1)<br \/>\nans =<br \/>\n1<br \/>\n&gt;&gt; out(2).yout(2)<br \/>\nans =<br \/>\n2<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>\u3061\u3083\u3093\u3068\u5404\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3054\u3068\u306b\u30b2\u30a4\u30f3\u304c\u5909\u5316\u3057\u3066\u3044\u307e\u3059\u306d\u3002\u6ce8\u610f\u70b9\u3068\u3057\u3066\u3001for \u30eb\u30fc\u30d7\u5185\u306b parsim \u95a2\u6570\u3092\u5165\u308c\u3066\u3057\u307e\u308f\u306a\u3044\u3088\u3046\u306b\u6c17\u3092\u3064\u3051\u307e\u3057\u3087\u3046\u3002\u52e2\u3044\u3067\u3084\u3063\u3066\u3057\u307e\u3044\u304c\u3061\u3067\u3059\u304c\u3001\u305d\u308c\u3092\u3057\u3066\u3057\u307e\u3046\u306810 x 10 = 100 \u56de\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3057\u3066\u3057\u307e\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3067\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u30b9\u30a4\u30fc\u30d7\u3057\u3066\u8907\u6570\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002\u6b21\u306f\u5165\u529b\u30c7\u30fc\u30bf\u3092\u8907\u6570\u4f7f\u7528\u3059\u308b\u65b9\u6cd5\u3092\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>&nbsp;<\/p>\n<h1><span style=\"color: #ff6600\">3. \u5916\u90e8\u5165\u529b\u306e\u5909\u66f4<\/span><\/h1>\n<p>SimulationInput \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e <a href=\"https:\/\/jp.mathworks.com\/help\/simulink\/slref\/simulink.simulationinput.setexternalinput.html\">setExternalInput<\/a>\u00a0\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u5916\u90e8\u5165\u529b\u3092\u5404\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3054\u3068\u306b\u5909\u66f4\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u307e\u305f\u8d85\u7c21\u5358\u306a\u30e2\u30c7\u30eb\u3067\u8a66\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1316\" height=\"740\" class=\"alignnone size-full wp-image-5548\" src=\"https:\/\/blogs.mathworks.com\/japan-community\/files\/2022\/03\/myModel2.png\" alt=\"\" \/><\/p>\n<p>\u307e\u305a\u306f\u5404\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u5165\u529b\u30c7\u30fc\u30bf\u3092\u7528\u610f\u3057\u307e\u3059\u3002<\/p>\n<pre><code>t = (0:0.1:10)';\r\nu1 = t;\r\nu2 = sin(t);\r\nu3 = -cos(t);\r\nu = {u1,u2,u3};<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>\u5165\u529b\u30c7\u30fc\u30bf\u306f\u30d9\u30af\u30c8\u30eb\u306b\u306a\u308b\u3053\u3068\u304c\u591a\u3044\u306e\u3067\u3001<a href=\"https:\/\/jp.mathworks.com\/help\/matlab\/cell-arrays.html\">\u30bb\u30eb\u914d\u5217<\/a>\u3084\u884c\u5217\u3067\u307e\u3068\u3081\u3066\u304a\u304f\u3068\u30eb\u30fc\u30d7\u3067\u4f7f\u3044\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002\u3042\u3068\u306f\u30d1\u30e9\u30e1\u30fc\u30bf\u30b9\u30a4\u30fc\u30d7\u3068\u540c\u69d8\u306b for \u30eb\u30fc\u30d7\u3067\u5404\u8981\u7d20\u306b\u5165\u529b\u30c7\u30fc\u30bf\u3092\u8a2d\u5b9a\u3059\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<pre><code><span style=\"color: #0000ff\">for<\/span> i = 10:-1:1\r\n  in(i) = Simulink.SimulationInput(<span style=\"color: #ff00ff\">\"myModel2\"<\/span>);\r\n  in(i) = in(i).setExternalInput([t,u{i}]);\r\n<span style=\"color: #0000ff\">end<\/span>\r\nout = parsim(in)<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u7d50\u679c\u3092\u78ba\u8a8d\u3057\u3066\u307f\u308b\u3068\u2026\u2026<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"840\" height=\"630\" class=\"alignnone size-full wp-image-5551\" src=\"https:\/\/blogs.mathworks.com\/japan-community\/files\/2022\/03\/simResult.png\" alt=\"\" \/><\/p>\n<p>\u3057\u3063\u304b\u308a\u5225\u3005\u306e\u5165\u529b\u30c7\u30fc\u30bf\u304c\u4f7f\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u306d\uff01<\/p>\n<p>&nbsp;<\/p>\n<h1><span style=\"color: #ff6600\">4. \u8907\u6570\u306e\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u72b6\u6cc1\u30fb\u7d50\u679c\u3092\u53ef\u8996\u5316\u3059\u308b<\/span><\/h1>\n<p>\u8907\u6570\u306e\u5927\u898f\u6a21\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u4e26\u5217\u5b9f\u884c\u3057\u3066\u3044\u308b\u5834\u5408\u3001\u5404\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u9032\u6357\u72b6\u6cc1\u3092\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b\u78ba\u8a8d\u3067\u304d\u308b\u3068\u4fbf\u5229\u3067\u3059\u3088\u306d\u3002\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3092\u4f7f\u3046\u3068\u3001\u8907\u6570\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u72b6\u6cc1\u3092\u78ba\u8a8d\u3057\u305f\u308a\u3001\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u7d50\u679c\u3092\u7c21\u5358\u306b\u53ef\u8996\u5316\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f7f\u3044\u65b9\u306f\u8d85\u7c21\u5358\u3067\u3059\u3002parsim \u95a2\u6570\u3067\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3059\u308b\u969b\u306b ShowSimulationManager \u30aa\u30d7\u30b7\u30e7\u30f3\u3092 on \u306b\u3059\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<p><code>out = parsim(in, <span style=\"color: #ff00ff\">\"ShowSimulationManager\"<\/span>, <span style=\"color: #ff00ff\">\"on\"<\/span>)<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>\u3053\u308c\u3067\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u5b9f\u884c\u6642\u306b\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u304c\u8d77\u52d5\u3057\u3001\u5404\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u72b6\u6cc1\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1000\" height=\"750\" class=\"alignnone size-full wp-image-5554\" src=\"https:\/\/blogs.mathworks.com\/japan-community\/files\/2022\/03\/manager-1.png\" alt=\"\" \/><\/p>\n<p>\u7d50\u679c\u30da\u30a4\u30f3\u306e scatter \u3084 surf \u3092\u4f7f\u3048\u3070\u7279\u5b9a\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3068\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u7d50\u679c\u306e\u95a2\u4fc2\u3092\u53ef\u8996\u5316\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002\u4ed6\u306b\u3082\u69d8\u3005\u306a\u6a5f\u80fd\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u8a73\u3057\u304f\u77e5\u308a\u305f\u3044\u65b9\u306f<a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2021b\/simulink\/slref\/simulationmanager.html\">\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u3092\u3054\u78ba\u8a8d\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>&nbsp;<\/p>\n<h1><span style=\"color: #ff6600\">5. \u7d42\u308f\u308a\u306b<\/span><\/h1>\n<p>\u4eca\u56de\u306f parsim \u95a2\u6570\u3092\u7528\u3044\u305f\u8907\u6570\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u307e\u3057\u305f\u3002\u4ee5\u524d\u306e <a href=\"https:\/\/blogs.mathworks.com\/japan-community\/2020\/02\/19\/control-simulink-from-matlab-with-simulink-api\/?from=jp#:~:text=Simulink%20API%20%E3%81%A8%E3%81%AF%E3%80%81MATLAB,%E8%A1%8C%E3%81%86%E3%81%9F%E3%82%81%E3%81%AE%E6%A9%9F%E8%83%BD%E3%81%A7%E3%81%99%E3%80%82\">Simulink API \u306e\u8a18\u4e8b<\/a>\u00a0\u3068\u540c\u69d8\u3001MATLAB \u5074\u3067 Simulink \u7528\u306e\u95a2\u6570\u3092\u4f7f\u3046\u3053\u3068\u3067\u52b9\u7387\u5316\u3067\u304d\u308b\u30bf\u30b9\u30af\u306f\u305f\u304f\u3055\u3093\u3042\u308a\u307e\u3059\u3002\u666e\u6bb5 Simulink \u3060\u3051\u3092\u4f7f\u3063\u3066\u696d\u52d9\u3092\u884c\u3063\u3066\u3044\u308b\u65b9\u306f\u3001MATLAB \u3067\u697d\u3067\u304d\u306a\u3044\u304b\u8003\u3048\u3066\u307f\u308b\u306e\u3082\u610f\u5916\u3068\u9762\u767d\u3044\u3067\u3059\u3088\uff01<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/japan-community\/files\/2022\/03\/manager.png\" onError=\"this.style.display ='none';\" \/><\/div>\n<p>\u7686\u3055\u3093\u3053\u3093\u306b\u3061\u306f\u3002\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u9060\u85e4\u3067\u3059\u3002<br \/>\n\u3053\u306e\u30d6\u30ed\u30b0\u3067\u306f\u3001\u300cSimulink \u3068 MATLAB \u3092\u3064\u306a\u3050\u300d\u3092\u30b3\u30f3\u30bb\u30d7\u30c8\u3068\u3057\u3066\u3001\u4e3b\u306b\u6280\u8853\u7684\u306a\u5185\u5bb9\u306b\u3064\u3044\u3066\u66f8\u3044\u3066\u304a\u308a\u307e\u3059\u3002<br \/>\n&nbsp;<br \/>\n\u3055\u3066\u3001\u5148\u65e5\u3064\u3044\u306b R2022a&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/japan-community\/2022\/03\/23\/matlab-simulink-parsim\/\">read more >><\/a><\/p>\n","protected":false},"author":169,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[65,61],"tags":[67,69],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/posts\/5488"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/users\/169"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/comments?post=5488"}],"version-history":[{"count":38,"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/posts\/5488\/revisions"}],"predecessor-version":[{"id":8664,"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/posts\/5488\/revisions\/8664"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/media?parent=5488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/categories?post=5488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/tags?post=5488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}