How to complete this matrix?
古いコメントを表示
- Use the meshgrid function with the following data: -8: 0.5: 8
- Use the following equation: R=x2+y2 treat x and y as vectors
- Use the Z=sin RR
- Hint: you will need the following: Z(R==0)=1
- Use the mesh function for you variables
10 件のコメント
Rik
2019 年 10 月 23 日
This is your homework. What have you tried so far?
Briana Pass
2019 年 10 月 23 日
Guillaume
2019 年 10 月 23 日
Reusing the same variable name (x) for two different purpose is not a good idea. There's no limitation to the number of variables you can have.
You seem to have done step 1) and 2) and skipped 3) and 4). What's preventing you from doing these (other than them being very unclear as you've written them)?
Briana Pass
2019 年 10 月 23 日
Cyrus Tirband
2019 年 10 月 23 日
What is the error you get? Can you format your code using the code blocks in the comments? It looks like you have the right answer, but it's hard to tell because of the awful typesetting. Are you using the pointwise division operator (./) to calculate Z?
Guillaume
2019 年 10 月 23 日
In which line should I change X
Whichever you want, but it makes more sense to keep the output of meshgrid as x, since that's what your assignment use. The first x which serves a completely different purpose could be renamed to gridspacing or something similar.
Briana Pass
2019 年 10 月 23 日
Cyrus Tirband
2019 年 10 月 23 日
The assignment is asking you to plot z = sin (R)/R, you're plotting x*exp(R).
If you define Z like was asked, you'll have to account for the location where R = 0 (given the snippet you were given) because matlab will naïvely divide zero by zero and give you NaN or Inf. You can then plot Z with the surf command. You'll get something like this

Guillaume
2019 年 10 月 23 日
matlab will naïvely divide zero by zero and give you NaN or Inf
There is nothing naive about it. dividing zero by zero is mathematically undefined. Matlab will give you NaN (not a number) if you still do it, never Inf for that.
The function
is undefined at 0. You can define a new function that is:
is undefined at 0. You can define a new function that is:

which is what seems to be asked here.
Briana Pass
2019 年 10 月 23 日
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
