help me plz as soon well

hello guys
this is the code of my program
clear
clc
is=386*10^-6
tc= 86
k = 1.38*10^-23
q = 1.602*10^-19
vd_f = -10 : 0.01 : 0.7
tk=tc+273
id_f = is * (exp((q * vd_f)/(k * tk)) - 1)
vd_r = 0:-0.01:-10.0
id_r = -1*is
vt = 0.7 ;
vp = linspace(0 , ( 3*vt ) , 1071 )
subplot (221);
plot ( vd_f , id_f , 'b');
grid ;
xlabel ('V') ;
ylabel ('I' ) ;
title ( ' forward curve ' ) ;
subplot (222);
plot ( vd_r , id_r , 'r' );
grid ;
xlabel ('V') ;
ylabel ('I' ) ;
title ( ' saturation current ' ) ;
subplot ( 223 );
plot ( vp , id_f , 'g' )
grid ;
xlabel ('V') ;
ylabel ('I' ) ;
title ( ' power disspated ' ) ;
subplot ( 224 );
plot ( vd_f, id_f , 'b' , vd_r , id_r , 'r' , vp , id_f , 'g' );
grid ;
xlabel ('V') ;
ylabel ('I' ) ;
title ( ' I-V curve & power dissipated ' ) ;
i want to integration the function " id_f "
this the code i used
fun = @(q) is * (exp((q * vd_f)/(k * tk)) - 1)
quadgk(fun,0,inf)
but i got this error
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> @(q)is*(exp((q*vd_f)/(k*tk))-1)
Error in ==> quadgk>evalFun at 344
fx = FUN(x);
Error in ==> quadgk>f2 at 375
[y,too_close] = evalFun(t2t);
Error in ==> quadgk>vadapt at 258
[fx,too_close] = f(x);
Error in ==> quadgk at 205
[q,errbnd] = vadapt(@f2,interval);
help me plz
thanks

1 Comment

Adam
Adam on 1 Jun 2017
Edited: Adam on 1 Jun 2017
I can't see just by glancing at your code what size your matrices are, but with the debugger it is easy for you to investigate this yourself. The error message is very clear that you have matrices whose dimensions are not in agreement.
This may be because you have different sized matrices or it may be because you actually meant to use the element-wise
.*
operator instead of the matrix multiplication operator *
Please use a question title that succinctly describes the domain of the problem though. A title along the lines of 'Please help me' is no use to anyone.

Answers (2)

It appears to me that your function should perhaps be
fun = @(V) is * (exp((q * V)/(k * tk)) - 1)
but it is difficult to be sure as you did not clearly indicate which variable you want to integrate over when you asked your previous question. I changed it from q to V because you use V as your X axis.

2 Comments

whlter thank u , but same problem
No, with that change you do not get the problem you encountered.
Source code enclosed.
oueiss mohammad
oueiss mohammad on 1 Jun 2017
any one ......

1 Comment

Walter answered. If you didn't understand his answer, or if it didn't work when you tried it, or if you want to provide the information he implicitly requested, you should reply with a comment on his answer rather than writing a separate answer.

This question is closed.

Asked:

on 31 May 2017

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!