MATLAB Central Discussions - Join the conversation!
Main Content

Results for


    I know we have all been in that all-too-common situation of needing to inefficiently identify prime numbers using only a regular expression... and now Matt Parker from Standup Maths helpfully released a YouTube video entitled "How on Earth does ^.?$|^(..+?)\1+$ produce primes?" in which he explains a simple regular expression (aka Halloween incantation) which matches composite numbers:
    Here is my first attempt using MATLAB and Matt Parker's example values:
    fnh = @(n) isempty(regexp(repelem('*',n),'^.?$|^(..+?)\1+$','emptymatch'));
    fnh(13)
    ans = logical
    1
    fnh(15)
    ans = logical
    0
    fnh(101)
    ans = logical
    1
    fnh(1000)
    ans = logical
    0
    Feel free to try/modify the incantation yourself. Happy Halloween!
    Hello! The MathWorks Book Program is thrilled to welcome you to our discussion channel dedicated to books on MATLAB and Simulink. Here, you can:
    • Promote Your Books: Are you an author of a book on MATLAB or Simulink? Feel free to share your work with our community. We’re eager to learn about your insights and contributions to the field.
    • Request Recommendations: Looking for a book on a specific topic? Whether you're diving into advanced simulations or just starting with MATLAB, our community is here to help you find the perfect read.
    • Ask Questions: Curious about the MathWorks Book Program, or need guidance on finding resources? Post your questions and let our knowledgeable community assist you.
    We’re excited to see the discussions and exchanges that will unfold here. Whether you're an expert or beginner, there's a place for you in our community. Let's embark on this journey together!
    David
    David
    Last activity on 12 Sep 2024

    In case you haven't come across it yet, @Gareth created a Jokes toolbox to get MATLAB to tell you a joke.
    Image Analyst
    Image Analyst
    Last activity on 12 Aug 2024

    Imagine that the earth is a perfect sphere with a radius of 6371000 meters and there is a rope tightly wrapped around the equator. With one line of MATLAB code determine how much the rope will be lifted above the surface if you cut it and insert a 1 meter segment of rope into it (and then expand the whole rope back into a circle again, of course).
    While searching the internet for some books on ordinary differential equations, I came across a link that I believe is very useful for all math students and not only. If you are interested in ODEs, it's worth taking the time to study it.
    A First Look at Ordinary Differential Equations by Timothy S. Judson is an excellent resource for anyone looking to understand ODEs better. Here's a brief overview of the main topics covered:
    1. Introduction to ODEs: Basic concepts, definitions, and initial differential equations.
    2. Methods of Solution:
    • Separable equations
    • First-order linear equations
    • Exact equations
    • Transcendental functions
    1. Applications of ODEs: Practical examples and applications in various scientific fields.
    2. Systems of ODEs: Analysis and solutions of systems of differential equations.
    3. Series and Numerical Methods: Use of series and numerical methods for solving ODEs.
    This book provides a clear and comprehensive introduction to ODEs, making it suitable for students and new researchers in mathematics. If you're interested, you can explore the book in more detail here: A First Look at Ordinary Differential Equations.
    Hans Scharler
    Hans Scharler
    Last activity on 31 May 2024

    Spring is here in Natick and the tulips are blooming! While tulips appear only briefly here in Massachusetts, they provide a lot of bright and diverse colors and shapes. To celebrate this cheerful flower, here's some code to create your own tulip!
    Chen Lin
    Chen Lin
    Last activity on 9 Jun 2024

    Drumlin Farm has welcomed MATLAMB, named in honor of MathWorks, among ten adorable new lambs this season!
    📚 New Book Announcement: "Image Processing Recipes in MATLAB" 📚
    I am delighted to share the release of my latest book, "Image Processing Recipes in MATLAB," co-authored by my dear friend and colleague Gustavo Benvenutti Borba.
    This 'cookbook' contains 30 practical recipes for image processing, ranging from foundational techniques to recently published algorithms. It serves as a concise and readable reference for quickly and efficiently deploying image processing pipelines in MATLAB.
    Gustavo and I are immensely grateful to the MathWorks Book Program for their support. We also want to thank Randi Slack and her fantastic team at CRC Press for their patience, expertise, and professionalism throughout the process.
    ___________
    I found this plot of words said by different characters on the US version of The Office sitcom. There's a sparkline for each character from pilot to finale episode.
    Today, he got dressed for work to design some new dog toy-making algorithms. #nationalpetday
    Transforming my furry friend into a grayscale masterpiece with MATLAB! 🐾 #MATLABPetsDay
    This is Stella while waiting to see if the code works...
    Image Analyst
    Image Analyst
    Last activity on 25 Mar 2025 at 22:02

    In one line of MATLAB code, compute how far you can see at the seashore. In otherwords, how far away is the horizon from your eyes? You can assume you know your height and the diameter or radius of the earth.
    Adam Danz
    Adam Danz
    Last activity on 26 Dec 2024

    Me at the beginning of every meeting
    David
    David
    Last activity on 26 Mar 2024

    A bit late. Compliments to Chris for sharing.
    Athanasios Paraskevopoulos
    Athanasios Paraskevopoulos
    Last activity on 17 Mar 2024

    can you relate?
    Athanasios Paraskevopoulos
    Athanasios Paraskevopoulos
    Last activity on 14 Mar 2024

    Can you solve it?
    Go to top of page