Problem in writing code for this profile. Need urgent help
이전 댓글 표시
Respected sir
My profile equation is
U = 1./(mu).*(t_o.*(y-delta)+4.*lambda.*sqrt(t_o.*t_e).*(exp(-lamda./(2.*delta)))+t_e.*lambda.*(1-exp(-y./lambda)))
I want to plot U vs Y wih varying the value lamda and delta.
I want to see how the plot U VS Y behaves for different lamda and y value let s take an example
case1
lamda =0.8 delta 0.6
case 2
lamda =0.8 delta 0.16
case 3
lamda =0.5 delta 0.6
i have written taking one arbitary value but it is error my code
a= 100*(y-(3*(10^-6)));
b=9.2*10^-6;
c=exp(-0.5*(10^8)*y);
d=530*(10^-8)*(1-exp(-y*(10^8)));
e=b*c;
u=2*(a+e+d);
댓글 수: 3
Walter Roberson
2018년 11월 5일
편집: Walter Roberson
2018년 11월 5일
I do not see any lamda in the assignments you posted? I do not see mu, or t_o, or delta, or t_e in the assignments you posted?
It is not clear how a, b, c, d, e, or u fit into your equations?
Debasis Roy
2018년 11월 6일
답변 (1개)
Walter Roberson
2018년 11월 5일
mu = rand();
t_o = rand();
t_e = rand();
deltavals = [0.6 1.1 1.6];
lambdavals = [0.5 0.6 0.7 0.8];
yvals = -2:0.5:2;
[delta, lambda, y] = ndgrid(deltavals, lambdavals, yvals);
U = 1./(mu).*(t_o.*(y-delta)+4.*lambda.*sqrt(t_o.*t_e).*(exp(-lambda./(2.*delta)))+t_e.*lambda.*(1-exp(-y./lambda)));
volumeViewer(U)
댓글 수: 6
Debasis Roy
2018년 11월 6일
Walter Roberson
2018년 11월 7일
Minimal brackets version
mu = rand;
t_o = rand;
t_e = rand;
deltavals = [0.6 1.1 1.6];
lambdavals = [0.5 0.6 0.7 0.8];
yvals = -2:0.5:2;
[delta, lambda, y] = ndgrid(deltavals, lambdavals, yvals);
U = 1./mu.*(t_o.*(y-delta)+4.*lambda.*sqrt(t_o.*t_e).*exp(-lambda./(2.*delta))+t_e.*lambda.*(1-exp(-y./lambda)));
Yes, the volumeViewer was just for plotting.
Walter Roberson
2018년 11월 7일
편집: Walter Roberson
2018년 11월 10일
You could substitute meshgrid for ndgrid in this case.
Debasis Roy
2018년 11월 10일
편집: Walter Roberson
2018년 11월 10일
Walter Roberson
2018년 11월 10일
"I want different plot of u vs y corresponding to different values of lambda and delta"
Your inputs are y, lambda, and delta. Your output is u. With three inputs and 1 output, you are dealing with 4 dimensional plotting. However, you are trying to use plot(), which is for 2 dimensional plotting (one output for each input.)
In order to plot with three input variables and one output variable, the Mathworks plotting routines available are slice(), isosurface(), and volumeViewer(). You can also look in the File Exchange for vol3d v2 or https://www.mathworks.com/matlabcentral/fileexchange/59161-volumetric-3
Debasis Roy
2018년 11월 11일
편집: Debasis Roy
2018년 11월 11일
카테고리
도움말 센터 및 File Exchange에서 Spectral Estimation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!