Jump to content

Manoj Kandukuri

  • Content Count

  • Joined

  • Last visited

  • Days Won


Manoj Kandukuri last won the day on July 29 2019

Manoj Kandukuri had the most liked content!

About Manoj Kandukuri

  • Rank
    Advanced Member

Profile Information

  • Gender
  • Country
    United States
  • Interests
    Numerical Computing, Machine learning
  • Are you University user?

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi Batuhancoskun, As your variable 'str' is a string, you can get desired output by using indexing to get the "letters" form the string --> str(6:end) output: ForGeeks if you want to split a string at a desired character/delimiter you can use 'strplit', 'regexp' functions. Hope this helps
  2. Below is kind of a hack in 2019.2 1. set python as preferred language under file>preferences>Compose>General 2. open new python and OML files (to trigger OML command window) 3. close compose and relaunch you will see both OML and python interpreters.
  3. Hi Nils, you can use "set(gca,'xtick',7)" where 7 is number of ticks you want to have between the limits [0:t_sim]. hope this helps thanks, Manoj kandukuri
  4. Do you see 'fid' variable has a negative value ? if so, you might not have the 'nodes.txt' in the current working directory. can you please make sure you have the file in current working directory, if not change the working directory or have the fullpath to the file. like: fid =fopen('C:/temp/test.txt', 'r') thanks, Manoj kandukuri
  5. Hi Dung, you can get more accurate result by having a tolerance condition inside a while loop. something like below: %% clc, clear sum = 0; sum_before = realmax; tol = 1e-12; % tolerance value i = 0; while (abs(sum_before - sum) >= tol) i= i+ 1; sum_before = sum; sum = sum + 1/(i^2); end %% Hope this helps Thanks, Manoj kandukuri
  6. Please add the below lines on top in your zzz.py and it will do the trick. sys.path.append sets the path to import the files from the current folder. import sys sys.path.append('C:/Users/vkandukuri/Downloads') #change the path to the path where you have the files Thanks, Manoj kandukuri
  7. Hi Berker, As Python doesn't uses the plotting framework of OML, you can undock/dock the figure in python by using run_line_magic ipython api's set the positions and sizes. add below lines in your script to create pop up figure window from Python from IPython import get_ipython get_ipython().run_line_magic('matplotlib', 'qt') And to size the figure window you can use "matplotlib.rcParams['figure.figsize'] = (h, b)" where h and b are widow size. Note: get_ipython().run_line_magic('matplotlib', 'qt') undocks the figure window and get_ipython().run_line_magic('matplotlib', 'inline') docks the figure in command window. I have edited your python script as attached. hope this helps. If you want to have the plots inside OML only, then you can transfer the data from python back to Compose OML (by using getpythonvar command) and then plot inside OML. Did you try transferring of data back to OML from python and then do plotting inside OML? Thanks, Manoj kandukuri plot_test2_2.py
  8. Roberta, i just tried your suggestion, it didnt work. compose interpreted it as a string... Manoj kandukuri
  9. Hi Seoksan, you can save the plot to a variable and then set linewidth property for this variable.. clf; x = linspace(0,10,150); y = cos(5*x); h = plot(x,y,'b--o','linewidth',0.1); title('2-D Line Plot'); xlabel('x'); ylabel('cos(5x)') set(h, 'linewidth', 4) Manoj Kandukuri
  10. Thanks for your reply Jeff. I wanted to profile the functions used in oml scripts and their execution times in a report to improve the performance of the code. MK
  11. Is there a way to get list of functions (both inbuilt and user defined) used in .oml scripts? Thanks, MK
  12. Seoksan, I'm not sure why it didn't work but when i searched online, i found this is due to possible bug in axis('equal') - equal scaling by changing the limits when clf is refreshed, this causing the ylim changes to fade out. ( see https://github.com/matplotlib/matplotlib/issues/8093) Thanks, Manoj kandukuri
  13. Hi Seoksan, In the python file you have axis set to 'equal' and that is trying to make the axis limits to be equal. comment the line "plt.axis('equal')" and you can set the ylim and xlim as you requested. #plt.axis('equal') # axis limts plt.ylim(-4,2) plt.xlim(-1,5) Hope this helps MK
  14. Hi SeokSan, Meshgrid of x and y vectors would give you the rows of the output array X which are copies of the vector x; columns of the output array Y are copies of the vector y. in your 1st example: X values are replicates of vector x and Y values are replicates of vector y' (transpose of vector y), giving you X & Y as square matrices with data points representing in 2Dplane (something like Cartesian coordinates) So when you calculate z (in your 1st example) you're doing element-wise multiplication of sin(X) (which is x vector repeated Horizontally) and cos(Y) (which is y vector repeated vertically) in your 2nd example approach, while calculating c you're doing matrix multiplication of sin(a') (which is x vector repeated vertically) and cos(b) (which is y vector repeated Horizontally) which is not the same mathematical operation as your 1st approach. that is why you see 2 different graph's. so to achieve the same result with these 2 approaches; you need to surface plot of c' (transpose of matrix c) surf(a,b,c') or change the logic little bit a=[0:0.1:2*pi]; b=a'; c=cos(b)*sin(a); figure(2) surf(a,b,c) Hope this helps!
  • Create New...