Matlab vpasolve求解​方程组后怎么绘制图像​,求助各位大佬。

clc;
clear;
syms fx imax t n V Lm R fr fs Ta k immax;
fr=76e3;
Lm=80e-6;
n=0.7;
V=53.7;
R=50
fs=150e3;
Vin=200;
Lr=32e-6;
k=Vin/Lr;
a=asin(n*V/(4*Lm*imax*fs));
immax=n*V/(4*Lm*fs);
fx=imax*sin(2*pi*fr*t-a)-(n*V/Lm*t-n*V/(4*Lm*fs));
F1=2*int(fx,t,0,(1/(2*fs)))-Ta^2*k/2-V./(2.*n.*R.*fs)
F2=imax*sin(2*pi*fr*(1/2/fs-Ta)-a)-immax;
eqns=[F1==0,F2==Ta*k];
vars=[imax,Ta]
[imax,Ta]=vpasolve(eqns,vars,[-inf inf;0 1/4/fs])
这是单次计算的程序,现在想要绘制在变量R和fs变化情况下,Z轴为imax的三维图像,试了很多方法无效,求助各位大佬。

 Réponse acceptée

0 votes

把当前代码改写成可调用函数
然后循环调用最后绘图就是了
R = 42:1:58;
fs = 142e3:1e3:158e3;
imax = zeros(numel(R),numel(fs));
for ii = 1:1:numel(R)
    for jj = 1:1:numel(fs)
        imax(ii,jj) = MyCal(R(ii),fs(jj));
        disp([ii,jj])
    end
end
[R, fs] = meshgrid(R,fs);
surf(R,fs,imax);
xlabel('R'); ylabel('fs'); zlabel('imax');
function imax = MyCal(R,fs)
syms imax t Ta
fr=76e3;
Lm=80e-6;
n=0.7;
V=53.7;
Vin=200;
Lr=32e-6;
k=Vin/Lr;
a=asin(n*V/(4*Lm*imax*fs));
immax=n*V/(4*Lm*fs);
fx=imax*sin(2*pi*fr*t-a)-(n*V/Lm*t-n*V/(4*Lm*fs));
F1=2*int(fx,t,0,(1/(2*fs)))-Ta^2*k/2-V./(2.*n.*R.*fs);
F2=imax*sin(2*pi*fr*(1/2/fs-Ta)-a)-immax;
eqns=[F1==0,F2==Ta*k];
vars=[imax,Ta];
[imax,~]=vpasolve(eqns,vars,[-inf  inf;0  1/4/fs]);
end

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Parallel Server dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!