Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2008-06-08
年龄: 40
帖子: 2
声望力: 0 ![]() |
![]()
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: Emal:[email protected] |
![]() |
![]() |
|
|
![]() |
||||
主题 | 主题作者 | 版面 | 回复 | 最后发表 |
菜鸟问题 关于MATLAB中的FOR循环语句,大家帮帮忙哈 `` | rencheng | MATLAB论坛 | 4 | 2008-10-16 15:05 |
[求助]急求钻石滤波器设计 | ailin | MATLAB论坛 | 0 | 2008-09-05 23:53 |
[求助]求助毕设 关于基于matlab网络pid控制的 | aneeee | MATLAB论坛 | 1 | 2008-05-23 10:31 |
自己写的有限差分超松弛迭代程序 | abiao00000 | MATLAB论坛 | 0 | 2008-05-09 13:47 |
【求助】新人请教 | ghost1861 | MATLAB论坛 | 4 | 2008-03-28 21:38 |