![]() |
[求助]matlab web server的输出图像
matlab web server只有输入图像,没有输出图形
testweb1.html <html> <head> <meta http-equiv="content-type" content= " text/html; Charset=gb_2312-80"> </head> <body> <!--建立表单 --> <form action="/cgi-bin/matwab.exe" method="POST"> <!--添加隐含输入项mlmfile,替换my_m_file为matlab程序名--> <input type="hidden" name="mlmfile" value="testweb1"> <!--添加MATLAB应用程序的输入变量,替换变量MY_INPUT_VARIABLE_1 --> <p>二阶系统阶跃响应:H(S)=(wn.^2)/(s^2+2ζwn.s+wn.^2) 其中为ξ自然频率,wn为相对阻尼系数。是绘制出wn为0.1,0.2,* * *,1.0,2.0时单位阶跃响应</p> <p>输入wn: <input type="text" name="wn" value="testweb1"></p> <!-- 添加其他html语句 --> <!-- submit按钮,单击按钮时启动MATLAB程序 --> <p><input type="submit" name="submit" value="submit"></p> </form> </body> </html> testweb1.m: function retstr = testweb1(in) % retstr是返回字符申,将来用于生成静态HTML文件 % 初始化返回字符串 retstr = char("); %设置工作目录,保存图片用 cd(in.mldir); %读取html文件中表单数据 Wn=str2double(in.wn); %计算 Kosi=[0.1:0.1:1.0,2.0]; Figure(1) Hold on For kos=kosi Num=wn.^2; Den=[1,2*kos*wn,wn.^2]; Step(num,den) F=figure(‘visible’, ‘off’); Plot(step) Drawnow; Plc=sprintf(‘&spic.jpeg’,in.mild); Wsprintjpeg(f,pic); Close(f); %设置输出变量,供输出html文件用 Out.pic=pic; %调用htmlrep,生成html输出文件 tmpfile=which('testtmp1.html'); retstr=htmlrep(out,tmpfile); testtmp1.html <html> <head> <meta http-equiv="content-type" content="text/html; charset=gb_2312-80"> <title>二阶系统的阶跃响应输出页面</title> </head> <body> 计算结果为: <center> <img src="/icons/$pic$"> </center> </body> </html> 急求帮忙修改及输出图形。:cry: Emai:[email protected] |
好好看看matlab里头的帮助
|
所有时间均为北京时间。现在的时间是 12:42。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.