0

I have caught myself in a issue, I know its not that difficult but I couldnt figure out how to implement it. I have an m file that looks like

clear;
PVinv.m_SwF=20e3

for m=1:1:70;  

PVinv.m_SwF=PVinv.m_SwF+1e3;
Lmin = PVinv.InductanceDimens();
Wa_Ac = PVinv.CoreSizeModel();
PVinv.CoreSelect(Wa_Ac);   
[loss_ind_core,loss_ind_copper] = PVinv.InductorLossModel(PVinv.m_L_Selected);
Total_Inductor_Loss=loss_ind_core+loss_ind_copper
plot(PVinv.m_SwF,Total_Inductor_Loss,'--gs');
hold on
xlim([10e3 90e3])
set(gca,'XTickLabel',{'10';'20';'30';'40';'50';'60';'70';'80';'90'})
grid on
xlabel('Switching Frequency [kHz]');
ylabel('Power loss [W]');

end

And the function that is of interest is CoreSelect(Wa_Ac)

function obj = CoreSelect(obj, WaAc)
             obj.m_Core_Available= obj.m_Core_List(i);
            obj.m_L_Selected.m_Core = obj.m_Core_Available;

end 

I want to change the value of i from obj.m_Core_List(1) to obj.m_Core_List(27) within that for loop of main m file. How can I get the value of the function coreselect when I call it in main m file For eg for m=1 to 70 I want the function to take the value of i=1 then execute till plot command and then same with but i=2 and so on Any suggestion would be really helpful

1
  • Thanks George it worked. But when plotting data i get only data points but no line connecting them I tried using meshgrid but it didnt seems working Commented Mar 20, 2012 at 15:47

1 Answer 1

1

I'm not sure I understand your question perfectly, but I think you want to pass an index i to the CoreSelect function, and loop i from 1 to 27 outside of the function. Try this:

function obj = CoreSelect(obj, WaAc, i)
...
end

for i=1:27,
   PVInv.CoreSelect(WaAc,i);
end
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.