主要内容

搜索

Hi, what’s the best way to learn MATLAB, Simulink, and Simscape? Do you recommend a learning path? I work in the Electrical & Electronics area for automotive systems.
The toughest problem in the Cody Contest 2025 is Clueless - Lord Ned in the Game Room. Thank you Matt Tearle for such as wonderful problem. We can approach this clueless(!) tough problem systematically.
Initialize knowledge Matrix
Based on the hints provided in the problem description, we can initialize a knowledge matrix of size n*3 by m+1. The rows of the knowledge matrix represent the different cards and the columns represent the players. In the knowledge matrix, the first n rows represent category 1 cards, the next n rows, category 2 and the next category 3. We can initialize this matrix with zeros. On the go, once we know that a player holds the card, we can make that entry as 1 and if a player doesn't have the card, we can make that entry as -1.
yourcards processing
These are cards received by us.
  1. In the knowledge matrix, mark the entries as 1 for the cards received. These entries will be the some elements along the column pnum of the knowledge matrix.
  2. Mark all other entries along the column pnum as -1, as we don't receive other cards.
  3. Mark all other entries along the rows corresponding to the received cards as -1, as other players cannot receive the cards that are with us.
commoncards processing
These are the common cards kept open.
  1. In the knowledge matrix, mark the entries as 1 for the common cards. These entries will be some elements along the column (m+1) of the knowledge matrix.
  2. Mark all other entries along the column (m+1) as -1, as other cards are not common.
  3. Mark all other entries along the rows corresponding to the common cards as -1, as other players cannot receive the cards that are common.
Result -1 processing
In the turns input matrix, the result (5th column) value -1 means, the corresponding player doesn't have the 3 cards asked.
  1. Find all the rows with result as -1.
  2. For those corresponding players (1st element in each row of turns matrix), mark -1 entries in the knowledge matrix for those 3 absent cards.
pnum turns processing
These are our turns, so we get definite answers for the asked cards. Make sure to traverse only the rows corresponding to our turn.
  1. The results with -1 are already processed in the previous step.
  2. The results other than -1 means, that particular card is present with the asked player. So mark the entry as 1 for the corresponding player in the knowledge matrix.
  3. Mark all other entries along the row corresponding to step 2 as -1, as other players cannot receive this card.
Result 0 processing
So far, in the yourcards processing, commoncards processing, result -1 processing and pnum turns processing, we had very straightforward definite knowledge about the presence/absence of the card with a player. This step onwards, the tricky part of the problem begins.
result 0 means, any one (or more) of the asked cards are present with the asked player. We don't know exactly which card.
  1. For the asked player, if we have a definite no answer (-1 value in the knowledge matrix) for any two of the three asked cards, then we are sure about the card that is present with the player.
  2. Mark the entry as 1 for the definitely known card for the corresponding player in the knowledge matrix.
  3. Mark all other entries along the row corresponding to step 2 as -1, as other players cannot receive this card.
Cards per Player processing
Based on the number of cards present in the yourcards, we know the ncards, the number of cards per player.
Check along each column of the knowledge matrix, that is for each player.
  1. If the number of ones (definitely present cards) is equal to ncards, we can make all other entries along the column as -1, as this player cannot have any other card.
  2. If the sum of number of ones (definitely present cards) and the number of zeros (unknown cards) is equal to ncards, we can (i) mark the zero entries as one, as the unknown cards have become definitely present cards, (ii) mark all other entries along the column as -1, as other players cannot have any other card.
Category-wise cards checking
For each category, we must get a definite card to be present in the envelope.
  1. In each category (For every group of n rows of knowledge matrix), check for a row with all -1s. That is a card which is definitely not present with any of the players. Then this card will surely be present in the envelope. Add it to the output.
  2. If we could not find an all -1 row, then in that category, check each row for a 1 to be present. Note down the rows which doesn't have a 1. Those cards' players are still unknown. If we have only one such row (unknown card), then it must be in the envelope, as from each category one card is present in the envelope. Add it to the output.
  3. For the card identified in Step 2, mark all the entries along that row in the knowledge matrix as -1, as this card doesn't belong to any player.
Looping Over
In our so far steps, we could note that, the knowledge matrix got updated even after "Result 0 processing" step. This updation in the knowledge matrix may help the "Result 0 processing" step, if we perform it again. So, we can loop over the steps, "Result 0 processing", "Cards per Player processing" and "Category-wise cards checking" again. This ensures that, we will get the desired number of envelop cards (three in our case) as output.
Hoping to see, many of you to finish Cody Contest 2025 and make our team win the trophy.
Cephas
Cephas
上次活动时间: 大约 19 小时 前

Instead of growing arrays inside a loop, preallocate with zeros(), ones(), or nan(). It avoids memory fragmentation and speeds up Cody solutions.
A = zeros(1,1000);
Cephas
Cephas
上次活动时间: 大约 19 小时 前

Cody often hides subtle hints in example outputs — like data shape, rounding, or format. Matching those exactly saves you a lot of debugging time.
Don’t miss out on two incredible keynotes that will shape the future of engineering and innovation:
1️What’s New in MATLAB and Simulink in 2025
Get an inside look at the latest features designed to supercharge your workflows:
  • A redesigned MATLAB desktop with customizable sidebars, light/dark themes, and new panels for coding tasks
  • MATLAB Copilot – your AI-powered assistant for learning, idea generation, and productivity
  • Simulink upgrades, including an enhanced quick insert tool, auto-straightening signal lines, and new methods for Python integration
  • New options to deploy AI models on Qualcomm and Infineon hardware
2️Accelerating Software-Defined Vehicles with Model-Based Design
See how MathWorks + NXP are transforming embedded system development for next-gen vehicles:
  • Vehicle electrification example powered by MATLAB, Simulink, and NXP tools
  • End-to-end workflow: modeling → validation → code generation → hardware deployment → real-time cloud monitoring
📅 When: November 13
💡Why Join? Stay ahead with cutting-edge tools, workflows, and insights from industry leaders.
👉 Register now and be part of the future of engineering!
Ludvig Nordin
Ludvig Nordin
上次活动时间: 大约 20 小时 前

idris
idris
上次活动时间: 2025-11-12,15:29

In the FAQs, I saw the procedure to download the "mobile background", is the the same thing as an award? If yes, good, else how can we get an award and what are the available ones?
iaabdulhameed@knu.ac.kr
idris
idris
上次活动时间: 2025-11-12,5:57

Glad to have watched the session, especially the part when the speaker, Arthur gave an answer to my question on "speech recognition use case" in Avionics.
Cephas
Cephas
上次活动时间: 2025-11-12,7:08

isequal() is your best friend for Cody! It compares arrays perfectly without rounding errors — much safer than == for matrix outputs.
Cephas
Cephas
上次活动时间: 2025-11-12,5:15

When Cody hides test cases, test your function with random small inputs first. If it works for many edge cases, it will almost always pass the grader.
What a fantastic start to Cody Contest 2025! In just 2 days, over 300 players joined the fun, and we already have our first contest group finishers. A big shoutout to the first finisher from each team:
  • Team Creative Coders: @Mehdi Dehghan
  • Team Cool Coders: @Pawel
  • Team Relentless Coders: @David Hill
  • 🏆 First finisher overall: Mehdi Dehghan
Other group finishers: @Bin Jiang (Relentless), @Mazhar (Creative), @Vasilis Bellos (Creative), @Stefan Abendroth (Creative), @Armando Longobardi (Cool), @Cephas (Cool)
Kudos to all group finishers! 🎉
Reminder to finishers: The goal of Cody Contest is learning together. Share hints (not full solutions) to help your teammates complete the problem group. The winning team will be the one with the most group finishers — teamwork matters!
To all players: Don’t be shy about asking for help! When you do, show your work — include your code, error messages, and any details needed for others to reproduce your results.
Keep solving, keep sharing, and most importantly — have fun!
Cephas
Cephas
上次活动时间: 2025-11-12,14:13

I realized that using vectorized logic instead of nested loops makes Cody problems run much faster and cleaner. Functions like any(), all(), and logical indexing can replace multiple for-loops easily !
Hi cool guys,
I hope you are coding so cool!
FYI, in Problem 61065. Convert Hexavigesimal to Decimal in Cody Contest 2025 there's a small issue with the text:
[ ... For example, the text ‘aloha’ would correspond to a vector of values [0 11 14 7 0], thus representing the base-26 value 202982 = 11*263 + 14*262 + 7*26 ...]
The bold section should be:
202982 = 11*26^3 + 14*26^2 + 7*26
goc3
goc3
上次活动时间: 2025-11-10,17:38

If you have solved a Cody problem before, you have likely seen the Scratch Pad text field below the Solution text field. It provides a quick way to get feedback on your solution before submitting it. Since submitting a solution takes you to a new page, any time a wrong solution is submitted, you have to navigate back to the problem page to try it again.
Instead, I use the Scratch Pad to test my solution repeatedly before submitting. That way, I get to a working solution faster without having to potentially go back and forth many times between the problem page and the wrong-solution page.
Here is my approach:
  1. Write a tentative solution.
  2. Copy a test case from the test suite into the Scratch Pad.
  3. Click the Run Function button—this is immediately below the Scratch Pad and above the Output panel and Submit buttons.
  4. If the solution does not work, modify the solution code, sometimes putting in disp() lines and/or removing semicolons to trace what the code is doing. Repeat until the solution passes.
  5. If the solution does work, repeat steps 2 through 4.
  6. Once there are no more test cases to copy and paste, clean up the code, if necessary (delete disp lines, reinstate all semicolons to suppress output). Click the Run Function button once more, just to make sure I did not break the solution while cleaning it up. Then, click the Submit button.
For problems with large test suites, you may find it useful to copy and paste in multiple test cases per iteration.
Hopefully you find this useful.
Title: Looking for Internship Guidance as a Beginner MATLAB/Simulink Learner
Hello everyone,
I’m a Computer Science undergraduate currently building a strong foundation in MATLAB and Simulink. I’m still at a beginner level, but I’m actively learning every day and can work confidently once I understand the concepts. Right now I’m focusing on MATLAB modeling, physics simulation, and basic control systems so that I can contribute effectively to my current project.
I’m part of an Autonomous Underwater Vehicle (AUV) team preparing for the Singapore AUV Challenge (SAUVC). My role is in physics simulation, controls, and navigation, and MATLAB/Simulink plays a major role in that pipeline. I enjoy physics and mathematics deeply, which makes learning modeling and simulation very exciting for me.
On the coding side, I practice competitive programming regularly—
Codeforces rating: ~1200
LeetCode rating: ~1500
So I'm comfortable with logic-building and problem solving. What I’m looking for:
I want to know how a beginner like me can start applying for internships related to MATLAB, Simulink, modeling, simulation, or any engineering team where MATLAB is widely used (including companies outside MathWorks).
I would really appreciate advice from the community on:
  • What skills should I strengthen first?
  • Which MATLAB/Simulink toolboxes are most important for beginners aiming toward simulation/control roles?
  • What small projects or portfolio examples should I build to improve my profile?
  • What is the best roadmap to eventually become a good candidate for internships in this area?
Any guidance, resources, or suggestions would be extremely helpful for me.
Thank you in advance to everyone who shares their experience!
The main round of Cody Contest 2025 kicks off today! Whether you’re a beginner or a seasoned solver, now’s your time to shine.
Here’s how to join the fun:
  • Pick your team — choose one that matches your coding personality.
  • Solve Cody problems — gain points and climb the leaderboard.
  • Finish the Contest Problem Group — help your team win and unlock chances for weekly prizes by finishing the Cody Contest 2025 problem group.
  • Share Tips & Tricks — post your insights to win a coveted MathWorks Yeti Bottle.
  • Bonus Round — 2 players from each team will be invited to a fun live code-along event!
  • Watch Party – join the big watch event to see how top players tackle Cody problems
Contest Timeline:
  • Main Round: Nov 10 – Dec 7, 2025
  • Bonus Round: Dec 8 – Dec 19, 2025
Big prizes await — MathWorks swag, Amazon gift cards, and shiny virtual badges!
We look forward to seeing you in the contest — learn, compete, and have fun!
Hi everyone!
I’m Kishen Mahadevan, Senior Product Manager at MathWorks, where I focus on controls and deep learning. I’m excited to be speaking at MATLAB EXPO this year!
In one of my sessions, I’ll share how AI-based reduced order models (ROMs) are transforming engineering workflows—using battery fast charging as an example—making it easier to reuse high-fidelity models for real-time control and deployment.
I’d love to have you join the conversation at the EXPO and right here in the community!
Feel free to drop any questions or thoughts ahead of the event.
Jorge Bernal-AlvizJorge Bernal-Alviz shared the following code that requires R2025a or later:
Test()
Warning: Hardware-accelerated graphics is unavailable. Displaying fewer markers to preserve interactivity.
function Test()
duration = 10;
numFrames = 800;
frameInterval = duration / numFrames;
w = 400;
t = 0;
i_vals = 1:10000;
x_vals = i_vals;
y_vals = i_vals / 235;
r = linspace(0, 1, 300)';
g = linspace(0, 0.1, 300)';
b = linspace(1, 0, 300)';
r = r * 0.8 + 0.1;
g = g * 0.6 + 0.1;
b = b * 0.9 + 0.1;
customColormap = [r, g, b];
figure('Position', [100, 100, w, w], 'Color', [0, 0, 0]);
axis equal;
axis off;
xlim([0, w]);
ylim([0, w]);
hold on;
colormap default;
colormap(customColormap);
plothandle = scatter([], [], 1, 'filled', 'MarkerFaceAlpha', 0.12);
for i = 1:numFrames
t = t + pi/240;
k = (4 + 3 * sin(y_vals * 2 - t)) .* cos(x_vals / 29);
e = y_vals / 8 - 13;
d = sqrt(k.^2 + e.^2);
c = d - t;
q = 3 * sin(2 * k) + 0.3 ./ (k + 1e-10) + ...
sin(y_vals / 25) .* k .* (9 + 4 * sin(9 * e - 3 * d + 2 * t));
points_x = q + 30 * cos(c) + 200;
points_y = q .* sin(c) + 39 * d - 220;
points_y = w - points_y;
CData = (1 + sin(0.1 * (d - t))) / 3;
CData = max(0, min(1, CData));
set(plothandle, 'XData', points_x, 'YData', points_y, 'CData', CData);
brightness = 0.5 + 0.3 * sin(t * 0.2);
set(plothandle, 'MarkerFaceAlpha', brightness);
drawnow;
pause(frameInterval);
end
end
Jack and Cleve had famously noted in the "A Preview of PC-MATLAB" in 1985: For those of you that have not experienced MATLAB, we would like to try to show you what everybody is excited about ... The best way to appreciate PC-MATLAB is, of course, to try it yourself.
Try out the end-to-end workflow of developing touchless applications with both MathWorks' tools and STM Dev Cloud from last year!
You can check out the exercises and the manual.
You can also register this year's EXPO. Join the Hands-On workshops to learn the latest features that make the design and deployment workflow even easier!