qq10268061 2022-09-19 13:46 采纳率: 0%
浏览 190
已结题

matlab 卡诺循环代码

给个代码就行各位,如果可以的话在代码后面给个%%说每个代码啥意思
把下面的题弄成一个代码

img

img

img

img

img

img

  • 写回答

1条回答 默认 最新

  • Wayne_Fine 优质创作者: 嵌入式与硬件开发技术领域 2022-09-19 14:29
    关注
    获得17.50元问题酬金
    clc,clear,close all;
    %a——c
    x_ab = [1,1.25,1.6];
    y_ab = [1,0.8,0.625];
    x_bc = [1.6,1.8,2.24];
    y_bc = [0.625,0.5,0.358];
    %interp1三次样条插值
    xq_ab = linspace(1,1.6,100);  %100个点密度
    vq_ab = interp1(x_ab,y_ab,xq_ab,'spline');
    plot(xq_ab,vq_ab,"LineWidth",2);
    hold on
    xq_bc = linspace(1.6,2.24,100);
    vq_bc = interp1(x_bc,y_bc,xq_bc,'spline');
    plot(xq_bc,vq_bc,'g--',"LineWidth",2);
    %c——a
    x_ad = [1,1.15,1.4];
    y_ad = [1,0.8,0.572];
    x_dc = [1.4,1.6,2.24];
    y_dc = [0.572,0.5,0.358];
    %interp1三次样条插值
    xq_ad = linspace(1,1.4,100);  %100个点密度
    vq_ad = interp1(x_ad,y_ad,xq_ad,'spline');
    plot(xq_ad,vq_ad,'c-',"LineWidth",2);
    xq_dc = linspace(1.4,2.24,100);
    vq_dc = interp1(x_dc,y_dc,xq_dc,'spline');
    plot(xq_dc,vq_dc,'r-.',"LineWidth",2);
    grid on
    axis([0 2.5 0 1])
    
    %贴abcd标签
    text(1.02,1,'a','FontSize',15)
    text(1.63,0.625,'b','FontSize',15)
    text(2.27,0.358,'c','FontSize',15)
    text(1.43,0.572,'d','FontSize',15)
    
    stem(1,1,'k--')
    %表示(0,1)与(1,1)之间有水平连线,以此类推画出其他水平横线
    line([0 1],[1,1],'LineStyle','--','Color','k')
    stem(1.6,0.625,'k--')
    line([0 1.6],[0.625,0.625],'LineStyle','--','Color','k')  
    stem(1.4,0.572,'k--')
    line([0 1.4],[0.572,0.572],'LineStyle','--','Color','k')
    stem(2.24,0.358,'k--')
    line([0 2.24],[0.358,0.358],'LineStyle','--','Color','k') 
    
    %贴刻度标签
    text(0,1,'1','FontSize',13)
    text(0,0.625,'0.625','FontSize',13)
    text(0,0.358,'0.358','FontSize',13)
    text(0,0.572,'0.572','FontSize',13)
    
    text(1,0,'1','FontSize',13)
    text(1.4,0,'1.4','FontSize',13)
    text(1.6,0,'1.6','FontSize',13)
    text(2.24,0,'2.24','FontSize',13)
    
    %图例
    legend("等温过程T_1/T_a=1","绝热过程","绝热过程","等温过程T_2/T_a=0.8")
    title("卡诺循环图")
    xlabel("体积V/V_a")
    ylabel("压强P/P_a")
    

    img

    clc,clear,close all;
    %a——c
    x_dc = [0.544,0.6,0.871];
    y_dc = [2.76,2.5,1.72];
    x_cb = [0.871,0.95,1.6];
    y_cb = [1.72,1.5,0.625];
    %interp1三次样条插值
    xq_dc = linspace(0.544,0.871,100);  %100个点密度
    vq_dc = interp1(x_dc,y_dc,xq_dc,'spline');
    plot(xq_dc,vq_dc,'r-.',"LineWidth",2);
    hold on
    xq_cb = linspace(0.871,1.6,100);
    vq_cb = interp1(x_cb,y_cb,xq_cb,'spline');
    plot(xq_cb,vq_cb,'g--',"LineWidth",2);
    %c——a
    x_da = [0.544,0.68,1];
    y_da = [2.76,2,1];
    x_ab = [1,1.2,1.6];
    y_ab = [1,0.8,0.625];
    %interp1三次样条插值
    xq_da = linspace(0.544,1,100);  %100个点密度
    vq_da = interp1(x_da,y_da,xq_da,'spline');
    plot(xq_da,vq_da,'c-',"LineWidth",2);
    xq_ab = linspace(1,1.6,100);
    vq_ab = interp1(x_ab,y_ab,xq_ab,'spline');
    plot(xq_ab,vq_ab,'b',"LineWidth",2);
    grid on
    axis([0 1.6 0 3])
    
    %贴abdc标签
    text(1.02,1,'a','FontSize',15)
    text(1.61,0.625,'b','FontSize',15)
    text(0.892,1.72,'c','FontSize',15)
    text(0.564,2.76,'d','FontSize',15)
    
    stem(0.544,2.76,'k--')
    %表示(0,1)与(1,1)之间有水平连线,以此类推画出其他水平横线
    line([0 0.544],[2.76,2.76],'LineStyle','--','Color','k')
    stem(0.871,1.72,'k--')
    line([0 0.871],[1.72,1.72],'LineStyle','--','Color','k')  
    stem(1,1,'k--')
    line([0 1],[1,1],'LineStyle','--','Color','k')
    stem(1.6,0.625,'k--')
    line([0 1.6],[0.625,0.625],'LineStyle','--','Color','k') 
    % 
    %贴刻度标签
    text(0,2.76,'2.76','FontSize',13)
    text(0,1.72,'1.72','FontSize',13)
    text(0,1,'1','FontSize',13)
    text(0,0.625,'0.625','FontSize',13)
    
    text(0.544,0,'0.544','FontSize',13)
    text(0.871,0,'0.871','FontSize',13)
    text(1,0,'1','FontSize',13)
    text(1.6,0,'1.6','FontSize',13)
    
    %图例
    legend("等温过程T_2/T_a=1.5","绝热过程","绝热过程","等温过程T_1/T_a=1")
    title("卡诺循环图")
    xlabel("体积V/V_a")
    ylabel("压强P/P_a")
    

    img

    复制到网页版matlab直接运行就行:https://matlab.mathworks.com/

    img

    评论 编辑记录

报告相同问题?

问题事件

  • 系统已结题 9月27日
  • 请采纳用户回复 9月22日
  • 创建了问题 9月19日