Hello, I have this matlab code and it does not work. I recieve "Sym/max error Input arguments must be convertible to floating-point numbers". Also i get an error at this line "IQmax=max(max(IQcalc));" why? What should I do? Thank you!
clear all;close all; clc;syms Vg Vo D L1 L2 C1 Co R VC1 VCo IL1 IL2 PoR=Vo^2/Po;VL1on=VC1 ;VL1off=Vg-VCo;VL2on=Vg-VC1 ;VL2off=-VC1;IC1on=IL2-IL1 ;IC1off=IL2;ICoon=-VCo/R ;ICooff=IL1-VCo/R;Eq1=D*VL1on+(1-D)*VL1off;Eq2=D*VL2on+(1-D)*VL2off;Eq3=D*IC1on+(1-D)*IC1off;Eq4=D*ICoon+(1-D)*ICooff;solutia=solve(Eq1,Eq2,Eq3,Eq4,VC1,VCo,IL1,IL2);VC1=simplify(solutia.VC1);VCo=simplify(solutia.VCo);IL1=simplify(solutia.IL1);IL2=simplify(solutia.IL2);IQ=simplify(D*(IL1));IQrms=simplify(sqrt(D)*(IL1));ID1=simplify(D*IL1);ID1rms=simplify(sqrt(D)*IL1);ID2=simplify((1-D)*IL2);ID2rms=simplify((sqrt(1-D)*IL2));ID3=simplify((1-D)*IL1);ID3rms=simplify(sqrt(1-D)*IL1);VD1=simplify(Vg);VD3=simplify(Vg*D.^2./(1-D));VQ=simplify(Vg);VD2=simplify(Vg);IQ=simplify(eval(IQ));IQrms=simplify(eval(IQrms));ID2=simplify(eval(ID2));ID2rms=simplify(eval(ID2rms));ID1=simplify(eval(ID1));ID1rms=simplify(eval(ID1rms));ID3=simplify(eval(ID3));ID3rms=simplify(eval(ID3rms));VQ=simplify(eval(VQ));VD1=simplify(eval(VD1));VD2=simplify(eval(VD2));VD3=simplify(eval(VD3));Vgmin=18; Vgmax=24; Vo=28; Pomin=12; Pomax=20; fs=80e3;Rmin=Vo^2/Pomax,Rmax=Vo^2/Pomin,D=(sqrt(Vo^2+2*Vo*Vg-3*Vg)+Vg-Vo)/(2*Vg);Dmax=(sqrt(Vo^2+2*Vo*Vgmin-3*Vgmin)+Vgmin-Vo)/(2*Vgmin),Dmin=(sqrt(Vo^2+2*Vo*Vgmax-3*Vgmax)+Vgmax-Vo)/(2*Vgmax),Vgcalc=Vgmin:0.1:Vgmax; Pocalc=Pomin:0.1:Pomax;for i=1:length(Vgcalc) for j=1:length(Pocalc) Vg=Vgcalc(i); Po=Pocalc(j); IQcalc(i,j)=eval(IQ); IQrmscalc(i,j)=eval(IQrms); VQcalc(i,j)=eval(VQ); ID2calc(i,j)=eval(ID2); ID2rmscalc(i,j)=eval(ID2rms); VD2calc(i,j)=eval(VD2); ID1calc(i,j)=eval(ID1); ID1rmscalc(i,j)=eval(ID1rms); VD1calc(i,j)=eval(VD1); ID3calc(i,j)=eval(ID3); ID3rmscalc(i,j)=eval(ID3rms); VD3calc(i,j)=eval(VD3); endendIQmax=max(max(IQcalc));mesh(Pocalc,Vgcalc,IQcalc); xlabel('Po'); ylabel('Vg');zlabel('IQ');figure; IQrmsmax=max(max(IQrmscalc)), mesh(Pocalc,Vgcalc,IQrmscalc); xlabel('Po'); ylabel('Vg'); zlabel('IQrms'); figure; VQmax=max(max(VQcalc)), mesh(Pocalc,Vgcalc,VQcalc); xlabel('Po'); ylabel('Vg'); zlabel('VQ'); ID1max=max(max(ID1calc)), mesh(Pocalc,Vgcalc,ID1calc); xlabel('Po'); ylabel('Vg'); zlabel('ID1'); figure; ID1rmsmax=max(max(ID1rmscalc)), mesh(Pocalc,Vgcalc,ID1rmscalc); xlabel('Po'); ylabel('Vg'); zlabel('ID1rms'); figure; VD1max=max(max(VD1calc)), mesh(Pocalc,Vgcalc,VD1calc); xlabel('Po'); ylabel('Vg'); zlabel('VD1'); ID2max=max(max(ID2calc)), mesh(Pocalc,Vgcalc,ID2calc); xlabel('Po'); ylabel('Vg'); zlabel('ID2'); figure; ID2rmsmax=max(max(ID2rmscalc)), mesh(Pocalc,Vgcalc,ID2rmscalc); xlabel('Po'); ylabel('Vg'); zlabel('ID2rms'); figure; VD2max=max(max(VD2calc)), mesh(Pocalc,Vgcalc,VD2calc); xlabel('Po'); ylabel('Vg'); zlabel('VD2'); ID3max=max(max(ID3calc)), mesh(Pocalc,Vgcalc,ID3calc); xlabel('Po'); ylabel('Vg'); zlabel('ID3'); figure; ID3rmsmax=max(max(ID3rmscalc)), mesh(Pocalc,Vgcalc,ID3rmscalc); xlabel('Po'); ylabel('Vg'); zlabel('ID3rms'); figure; VD3max=max(max(VD3calc)), mesh(Pocalc,Vgcalc,VD3calc); xlabel('Po'); ylabel('Vg'); zlabel('VD3'); IQmax=max(max(IQcalc)), IQrmsmax=max(max(IQrmscalc)), VQmax=max(max(VQcalc)), ID2max=max(max(ID2calc)), ID2rmsmax=max(max(ID2rmscalc)), VD2max=max(max(VD2calc)), ID1max=max(max(ID1calc)), ID1rmsmax=max(max(ID1rmscalc)), VD1max=max(max(VD1calc)), ID3max=max(max(ID3calc)),ID3rmsmax=max(max(ID3rmscalc)), VD3max=max(max(VD3calc))
Best Answer