Asked by Debasis Roy
on 5 Nov 2018

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);

Answer by Walter Roberson
on 5 Nov 2018

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)

Debasis Roy
on 10 Nov 2018

Sir if I write is it ok? but I am not getting the result. As I want different plot of u vs y corresponding to different values of lambda and delta

mu=0.6;

t_o=106;

t_e=156;

deltavals = [0.6 1.1 1.6];

lambdavals = [0.5 0.6 0.7 0.8];

yvals = 0.3:0.1:1;

[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)))

plot(y,U,'-r')

Walter Roberson
on 10 Nov 2018

"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
on 11 Nov 2018

ok, sir thank you for clarifying my doubt. Now I am realizing my fault about this, I have attached one picture for plot i want u vs y plot like this .I am editting it mu=0.6;

t_o=106;

t_e=156;

deltavals = 0.6 ;

alphavals = [-0.3,- 0.2 ,-0.1,0, 0.1,0.2,0.3 ];

yvals = 0.3:0.1:1;

[ alpha, y] = ndgrid( alphavals, yvals);

U = 1./mu.*(t_o.*(y-delta)+4.*alpha.*sqrt(t_o.*t_e).*exp(- alpha./(2.*delta))+t_e.*alpha.*(1-exp(-y./alpha)))

plot(y,U,'-r')

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 3 Comments

## Walter Roberson (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/428137-problem-in-writing-code-for-this-profile-need-urgent-help#comment_633106

## Debasis Roy (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/428137-problem-in-writing-code-for-this-profile-need-urgent-help#comment_633229

## Walter Roberson (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/428137-problem-in-writing-code-for-this-profile-need-urgent-help#comment_635395

Sign in to comment.