MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Amanda Kit Ting
on 6 Oct 2013

Don't help me to solve just needed guidance of how to put it into programming code.

a) Calculate and plot the ideal gas pressure as a function of volume for a given temperature. Mathematically, the operations can be written as shown below: (what does this question means?)

R = 8.31453Jmol-1K-1 T = 273.15K N = 7mol v = (0.1m3,0.3m3,…,1.5m3) e = (1,1,…,1)T t = Te P = NRdiag(v)-1t

(b) Plot an exponentially decaying sine plot = e-0.4xsinx, 0 < x < 4π, taking 10, 50, and 100 points in the interval. [Be careful about computing y. You need array multiplication between e-0.4x and sin(x)](what does a exponentially decaying sine plot looks like?)

(c) Let h(t)= <x, y, t > where x =t cos(t), y = t sin(t) for -10π ≤ t ≤ 10π be the space curve. Plot its graph over the indicated interval using 3d plot. (How to make a plot to become a 3d graph?)

Answer by Image Analyst
on 6 Oct 2013

Accepted answer

A hint for (b): they mean to use .* instead of * to do element by element multiplication instead of matrix multiplication. Same hint for (c). Another hint: linspace() function.

## 9 Comments

## dpb (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/89325#comment_172602

"Possible" isn't the issue; homework only gets help when the student has shown an effort and their work to date and has a specific puzzle/problem; not "do my work for me"

## Jan Simon (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/89325#comment_172604

I agree with dpb: What kind of help do you expect? Do you want us to solve your homework? If so, please read: http://www.mathworks.com/matlabcentral/answers/8626-how-do-i-get-help-on-homework-questions-on-matlab-answers

## Amanda Kit Ting (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/89325#comment_172648

Not do my homework for me, seriously I need help with this question. For example like how to plot 3d graphs and samples of previous similar questions cause I don't know how to put these together to work like a program? Maybe because of the way I put it that cause the misunderstanding but I just need some guidance.

## Amanda Kit Ting (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/89325#comment_172649

ImageAnalyst thx again for your help, another question is that what actually does question (a) means?

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/89325#comment_172651

The equation in (a) is a fancy way of rewriting the equation

as

for the case where V is a vector and R and T are not.

In MATLAB you could use

## Image Analyst (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/89325#comment_172652

I don't know what NRdiag is. For the others, you need to make a vector with all the values in it, like

Same for variable "e".

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/89325#comment_172653

The notation is mathematical rather than programming.

NRdiag(v)-1t represents N * R * inv( diag(v) ) * t

where diag(v) is the MATLAB operator for constructing a full matrix with the given vector on its main diagonal.

I believe

represents the transpose of the row vector [1,1,...1], and that

represents t = T * e where T is the constant given and e is the transposed row vector.

## Image Analyst (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/89325#comment_172656

That is confusing if T = transpose and T also equals temperature. But maybe she just couldn't reproduce superscripts like a small T in the editor.

## Amanda Kit Ting (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/89325#comment_172919

Hi guys,

the t in the operation e = (1,1,…,1)T is suppose to be transcipt.

and following the hints that you guys shown,

i've got the solution at matlab.

thanks for all your help.

appreciate it.